diff --git a/app/Http/Controllers/GamesController.php b/app/Http/Controllers/GamesController.php new file mode 100644 index 0000000..cf368c4 --- /dev/null +++ b/app/Http/Controllers/GamesController.php @@ -0,0 +1,10 @@ +join('weekdays', "schedules.weekday_id", "=", "weekdays.weekday_id") - ->join("games", "schedules.game_id", "=", "games.game_id") + ->join('weekdays', "schedules.weekday_id", "=", "weekdays.id") + ->join("games", "schedules.game_id", "=", "games.id") ->select("weekdays.weekday_name", "weekdays.current_date", "games.name", "schedules.stream_time") ->get(); return $finalSchedules; @@ -21,8 +21,8 @@ class SchedulesController extends Controller public function mmDate(){ $minmaxDates = DB::table("weekdays") - ->select("weekdays.current_date")->where("weekday_id", "=", 1) - ->orWhere("weekday_id", "=", 7) + ->select("weekdays.current_date")->where("weekdays.id", "=", 1) + ->orWhere("weekdays.id", "=", 7) ->get(); return $minmaxDates; } diff --git a/app/Models/User.php b/app/Models/User.php index 4d7f70f..fb8b2ee 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -8,7 +8,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Sanctum\HasApiTokens; -class User extends Authenticatable +class User extends \TCG\Voyager\Models\User { use HasApiTokens, HasFactory, Notifiable; diff --git a/composer.json b/composer.json index 75e1ed0..295f697 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.10", "laravel/sanctum": "^3.3", - "laravel/tinker": "^2.8" + "laravel/tinker": "^2.8", + "tcg/voyager": "^1.7" }, "require-dev": { "fakerphp/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index d110a3a..f36f2db 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,76 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9c491b8531eec05ba41a11d9276a5749", + "content-hash": "fb6ec7f789fc4935dd4bcecfe448f15d", "packages": [ + { + "name": "arrilot/laravel-widgets", + "version": "3.14.0", + "source": { + "type": "git", + "url": "https://github.com/arrilot/laravel-widgets.git", + "reference": "99419f5b6190825733c731bd3b44f49fdc56a6ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/arrilot/laravel-widgets/zipball/99419f5b6190825733c731bd3b44f49fdc56a6ad", + "reference": "99419f5b6190825733c731bd3b44f49fdc56a6ad", + "shasum": "" + }, + "require": { + "illuminate/cache": ">=9", + "illuminate/console": ">=9", + "illuminate/container": ">=9", + "illuminate/contracts": ">=9", + "illuminate/routing": ">=9", + "illuminate/support": ">=9", + "illuminate/view": ">=9", + "php": ">=7.4" + }, + "require-dev": { + "nunomaduro/larastan": "^2.6", + "phpunit/phpunit": "~8.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Arrilot\\Widgets\\ServiceProvider" + ], + "aliases": { + "Widget": "Arrilot\\Widgets\\Facade", + "AsyncWidget": "Arrilot\\Widgets\\AsyncFacade" + } + } + }, + "autoload": { + "psr-4": { + "Arrilot\\Widgets\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nekrasov Ilya", + "email": "nekrasov.ilya90@gmail.com" + } + ], + "description": "A powerful alternative to view composers. Asynchronous widgets, reloadable widgets, console generator, caching - everything you can think of.", + "homepage": "https://github.com/arrilot/laravel-widgets", + "keywords": [ + "ajax", + "laravel", + "widgets" + ], + "support": { + "issues": "https://github.com/arrilot/laravel-widgets/issues", + "source": "https://github.com/arrilot/laravel-widgets/tree/3.14.0" + }, + "time": "2023-11-19T18:27:27+00:00" + }, { "name": "brick/math", "version": "0.11.0", @@ -205,6 +273,350 @@ }, "time": "2022-10-27T11:44:00+00:00" }, + { + "name": "doctrine/cache", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", + "shasum": "" + }, + "require": { + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/2.2.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", + "type": "tidelift" + } + ], + "time": "2022-05-20T20:07:39+00:00" + }, + { + "name": "doctrine/dbal", + "version": "3.8.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "db922ba9436b7b18a23d1653a0b41ff2369ca41c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/db922ba9436b7b18a23d1653a0b41ff2369ca41c", + "reference": "db922ba9436b7b18a23d1653a0b41ff2369ca41c", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", + "doctrine/deprecations": "^0.5.3|^1", + "doctrine/event-manager": "^1|^2", + "php": "^7.4 || ^8.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" + }, + "require-dev": { + "doctrine/coding-standard": "12.0.0", + "fig/log-test": "^1", + "jetbrains/phpstorm-stubs": "2023.1", + "phpstan/phpstan": "1.10.58", + "phpstan/phpstan-strict-rules": "^1.5", + "phpunit/phpunit": "9.6.16", + "psalm/plugin-phpunit": "0.18.4", + "slevomat/coding-standard": "8.13.1", + "squizlabs/php_codesniffer": "3.9.0", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/console": "^4.4|^5.4|^6.0|^7.0", + "vimeo/psalm": "4.30.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\DBAL\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", + "homepage": "https://www.doctrine-project.org/projects/dbal.html", + "keywords": [ + "abstraction", + "database", + "db2", + "dbal", + "mariadb", + "mssql", + "mysql", + "oci8", + "oracle", + "pdo", + "pgsql", + "postgresql", + "queryobject", + "sasql", + "sql", + "sqlite", + "sqlserver", + "sqlsrv" + ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/3.8.3" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", + "type": "tidelift" + } + ], + "time": "2024-03-03T15:55:06+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + }, + "time": "2024-01-30T19:34:25+00:00" + }, + { + "name": "doctrine/event-manager", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32", + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "conflict": { + "doctrine/common": "<2.9" + }, + "require-dev": { + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8.8", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.28" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "support": { + "issues": "https://github.com/doctrine/event-manager/issues", + "source": "https://github.com/doctrine/event-manager/tree/2.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", + "type": "tidelift" + } + ], + "time": "2022-10-12T20:59:15+00:00" + }, { "name": "doctrine/inflector", "version": "2.0.9", @@ -1045,6 +1457,90 @@ ], "time": "2023-12-03T19:50:20+00:00" }, + { + "name": "intervention/image", + "version": "2.7.2", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "04be355f8d6734c826045d02a1079ad658322dad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/04be355f8d6734c826045d02a1079ad658322dad", + "reference": "04be355f8d6734c826045d02a1079ad658322dad", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1 || ^2.0", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "https://intervention.io/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ], + "support": { + "issues": "https://github.com/Intervention/image/issues", + "source": "https://github.com/Intervention/image/tree/2.7.2" + }, + "funding": [ + { + "url": "https://paypal.me/interventionio", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + } + ], + "time": "2022-05-21T17:30:32+00:00" + }, { "name": "laravel/framework", "version": "v10.41.0", @@ -1499,6 +1995,68 @@ }, "time": "2024-01-04T16:10:04+00:00" }, + { + "name": "laravel/ui", + "version": "v4.5.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/ui.git", + "reference": "da3811f409297d13feccd5858ce748e7474b3d11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/ui/zipball/da3811f409297d13feccd5858ce748e7474b3d11", + "reference": "da3811f409297d13feccd5858ce748e7474b3d11", + "shasum": "" + }, + "require": { + "illuminate/console": "^9.21|^10.0|^11.0", + "illuminate/filesystem": "^9.21|^10.0|^11.0", + "illuminate/support": "^9.21|^10.0|^11.0", + "illuminate/validation": "^9.21|^10.0|^11.0", + "php": "^8.0" + }, + "require-dev": { + "orchestra/testbench": "^7.35|^8.15|^9.0", + "phpunit/phpunit": "^9.3|^10.4|^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Ui\\UiServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Ui\\": "src/", + "Illuminate\\Foundation\\Auth\\": "auth-backend/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Laravel UI utilities and presets.", + "keywords": [ + "laravel", + "ui" + ], + "support": { + "source": "https://github.com/laravel/ui/tree/v4.5.0" + }, + "time": "2024-03-04T13:58:27+00:00" + }, { "name": "league/commonmark", "version": "2.4.1", @@ -2468,6 +3026,55 @@ ], "time": "2023-11-12T21:59:55+00:00" }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, { "name": "psr/clock", "version": "1.0.0", @@ -5441,6 +6048,89 @@ ], "time": "2023-12-28T19:16:56+00:00" }, + { + "name": "tcg/voyager", + "version": "v1.7", + "source": { + "type": "git", + "url": "https://github.com/thedevdojo/voyager.git", + "reference": "19286d193d7f9095d088b743cdd5e7d9649b0855" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thedevdojo/voyager/zipball/19286d193d7f9095d088b743cdd5e7d9649b0855", + "reference": "19286d193d7f9095d088b743cdd5e7d9649b0855", + "shasum": "" + }, + "require": { + "arrilot/laravel-widgets": "^3.7", + "doctrine/dbal": "^3.1|^3.5", + "ext-json": "*", + "illuminate/support": "~8.0|~9.0|~10.0", + "intervention/image": "^2.7", + "laravel/ui": ">=1.0", + "league/flysystem": "~1.1|~2.0|~3.0", + "php": "^7.3|^7.4|^8.0|^8.1|^8.2" + }, + "require-dev": { + "laravel/browser-kit-testing": ">=6.1.0", + "laravel/framework": "~8.0|~9.0|~10.0", + "orchestra/testbench": ">=6.0", + "orchestra/testbench-browser-kit": ">=4.0", + "phpunit/phpcov": ">=6.0", + "phpunit/phpunit": ">=8.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "TCG\\Voyager\\VoyagerServiceProvider", + "TCG\\Voyager\\Providers\\VoyagerDummyServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "TCG\\Voyager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tony Lea", + "email": "tony.lea@thecontrolgroup.com" + } + ], + "description": "A Laravel Admin Package for The Control Group to make your life easier and steer your project in the right direction", + "homepage": "https://voyager.devdojo.com/", + "keywords": [ + "admin", + "laravel", + "panel" + ], + "support": { + "issues": "https://github.com/the-control-group/voyager/issues", + "source": "https://github.com/the-control-group/voyager" + }, + "funding": [ + { + "url": "https://github.com/emptynick", + "type": "github" + }, + { + "url": "https://github.com/fletch3555", + "type": "github" + }, + { + "url": "https://github.com/tnylea", + "type": "github" + } + ], + "time": "2023-11-10T16:29:12+00:00" + }, { "name": "tijsverkoyen/css-to-inline-styles", "version": "v2.2.7", diff --git a/config/image.php b/config/image.php new file mode 100644 index 0000000..2b1d2c3 --- /dev/null +++ b/config/image.php @@ -0,0 +1,20 @@ + 'gd' + +]; diff --git a/config/voyager.php b/config/voyager.php new file mode 100644 index 0000000..4cd5a50 --- /dev/null +++ b/config/voyager.php @@ -0,0 +1,258 @@ + [ + 'add_default_role_on_register' => true, + 'default_role' => 'user', + 'default_avatar' => 'users/default.png', + 'redirect' => '/admin', + ], + + /* + |-------------------------------------------------------------------------- + | Controllers config + |-------------------------------------------------------------------------- + | + | Here you can specify voyager controller settings + | + */ + + 'controllers' => [ + 'namespace' => 'TCG\\Voyager\\Http\\Controllers', + ], + + /* + |-------------------------------------------------------------------------- + | Models config + |-------------------------------------------------------------------------- + | + | Here you can specify default model namespace when creating BREAD. + | Must include trailing backslashes. If not defined the default application + | namespace will be used. + | + */ + + 'models' => [ + // 'namespace' => 'App\\Models\\', + ], + + /* + |-------------------------------------------------------------------------- + | Storage Config + |-------------------------------------------------------------------------- + | + | Here you can specify attributes related to your application file system + | + */ + + 'storage' => [ + 'disk' => 'public', + ], + + /* + |-------------------------------------------------------------------------- + | Media Manager + |-------------------------------------------------------------------------- + | + | Here you can specify if media manager can show hidden files like(.gitignore) + | + */ + + 'hidden_files' => false, + + /* + |-------------------------------------------------------------------------- + | Database Config + |-------------------------------------------------------------------------- + | + | Here you can specify voyager database settings + | + */ + + 'database' => [ + 'tables' => [ + 'hidden' => ['migrations', 'data_rows', 'data_types', 'menu_items', 'password_resets', 'permission_role', 'personal_access_tokens', 'settings'], + ], + 'autoload_migrations' => true, + ], + + /* + |-------------------------------------------------------------------------- + | Multilingual configuration + |-------------------------------------------------------------------------- + | + | Here you can specify if you want Voyager to ship with support for + | multilingual and what locales are enabled. + | + */ + + 'multilingual' => [ + /* + * Set whether or not the multilingual is supported by the BREAD input. + */ + 'enabled' => false, + + /* + * Select default language + */ + 'default' => 'en', + + /* + * Select languages that are supported. + */ + 'locales' => [ + 'en', + //'pt', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Dashboard config + |-------------------------------------------------------------------------- + | + | Here you can modify some aspects of your dashboard + | + */ + + 'dashboard' => [ + // Add custom list items to navbar's dropdown + 'navbar_items' => [ + 'voyager::generic.profile' => [ + 'route' => 'voyager.profile', + 'classes' => 'class-full-of-rum', + 'icon_class' => 'voyager-person', + ], + 'voyager::generic.home' => [ + 'route' => '/', + 'icon_class' => 'voyager-home', + 'target_blank' => true, + ], + 'voyager::generic.logout' => [ + 'route' => 'voyager.logout', + 'icon_class' => 'voyager-power', + ], + ], + + 'widgets' => [ + + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Automatic Procedures + |-------------------------------------------------------------------------- + | + | When a change happens on Voyager, we can automate some routines. + | + */ + + 'bread' => [ + // When a BREAD is added, create the Menu item using the BREAD properties. + 'add_menu_item' => true, + + // which menu add item to + 'default_menu' => 'admin', + + // When a BREAD is added, create the related Permission. + 'add_permission' => true, + + // which role add premissions to + 'default_role' => 'admin', + ], + + /* + |-------------------------------------------------------------------------- + | UI Generic Config + |-------------------------------------------------------------------------- + | + | Here you change some of the Voyager UI settings. + | + */ + + 'primary_color' => '#22A7F0', + + 'show_dev_tips' => true, // Show development tip "How To Use:" in Menu and Settings + + // Here you can specify additional assets you would like to be included in the master.blade + 'additional_css' => [ + //'css/custom.css', + ], + + 'additional_js' => [ + //'js/custom.js', + ], + + 'googlemaps' => [ + 'key' => env('GOOGLE_MAPS_KEY', ''), + 'center' => [ + 'lat' => env('GOOGLE_MAPS_DEFAULT_CENTER_LAT', '32.715738'), + 'lng' => env('GOOGLE_MAPS_DEFAULT_CENTER_LNG', '-117.161084'), + ], + 'zoom' => env('GOOGLE_MAPS_DEFAULT_ZOOM', 11), + ], + + /* + |-------------------------------------------------------------------------- + | Model specific settings + |-------------------------------------------------------------------------- + | + | Here you change some model specific settings + | + */ + + 'settings' => [ + // Enables Laravel cache method for + // storing cache values between requests + 'cache' => false, + ], + + // Activate compass when environment is NOT local + 'compass_in_production' => false, + + 'media' => [ + // The allowed mimetypes to be uploaded through the media-manager. + // 'allowed_mimetypes' => '*', //All types can be uploaded + 'allowed_mimetypes' => [ + 'image/jpeg', + 'image/png', + 'image/gif', + 'image/bmp', + 'video/mp4', + ], + //Path for media-manager. Relative to the filesystem. + 'path' => '/', + 'show_folders' => true, + 'allow_upload' => true, + 'allow_move' => true, + 'allow_delete' => true, + 'allow_create_folder' => true, + 'allow_rename' => true, + /*'watermark' => [ + 'source' => 'watermark.png', + 'position' => 'bottom-left', + 'x' => 0, + 'y' => 0, + 'size' => 15, + ], + 'thumbnails' => [ + [ + 'type' => 'fit', + 'name' => 'fit-500', + 'width' => 500, + 'height'=> 500 + ], + ]*/ + ], +]; diff --git a/database/migrations/2024_01_30_063219_create_links_table.php b/database/migrations/2024_01_30_063219_create_links_table.php index 0d69f77..44bf47a 100644 --- a/database/migrations/2024_01_30_063219_create_links_table.php +++ b/database/migrations/2024_01_30_063219_create_links_table.php @@ -12,7 +12,7 @@ return new class extends Migration public function up(): void { Schema::create('links', function (Blueprint $table) { - $table->id('link_id'); + $table->id('id'); $table->text("link_name"); $table->text("link"); $table->text("image"); diff --git a/database/migrations/2024_01_31_025117_create_weekdays_table.php b/database/migrations/2024_01_31_025117_create_weekdays_table.php index 3f285f7..137922a 100644 --- a/database/migrations/2024_01_31_025117_create_weekdays_table.php +++ b/database/migrations/2024_01_31_025117_create_weekdays_table.php @@ -12,7 +12,7 @@ return new class extends Migration public function up(): void { Schema::create('weekdays', function (Blueprint $table) { - $table->id("weekday_id"); + $table->id("id"); $table->text("weekday_name"); $table->date("current_date"); }); diff --git a/database/migrations/2024_01_31_025321_create_games_table.php b/database/migrations/2024_01_31_025321_create_games_table.php index 5fc729f..7cdd9ce 100644 --- a/database/migrations/2024_01_31_025321_create_games_table.php +++ b/database/migrations/2024_01_31_025321_create_games_table.php @@ -12,7 +12,7 @@ return new class extends Migration public function up(): void { Schema::create('games', function (Blueprint $table) { - $table->id("game_id"); + $table->id("id"); $table->text("name"); }); } diff --git a/database/migrations/2024_01_31_025427_create_schedules_table.php b/database/migrations/2024_01_31_025427_create_schedules_table.php index cfcb0e3..a56d0f6 100644 --- a/database/migrations/2024_01_31_025427_create_schedules_table.php +++ b/database/migrations/2024_01_31_025427_create_schedules_table.php @@ -12,12 +12,12 @@ return new class extends Migration public function up(): void { Schema::create('schedules', function (Blueprint $table) { - $table->id("schedule_id"); + $table->id("id"); $table->foreignId("weekday_id")->constrained( - table: "weekdays", column: "weekday_id", indexName: "constraint_weekday_id" + table: "weekdays", column: "id", indexName: "constraint_weekday_id" ); $table->foreignId("game_id")->constrained( - table: "games", column: "game_id", indexName: "constraint_game_id" + table: "games", column: "id", indexName: "constraint_game_id" ); $table->text("stream_time"); }); diff --git a/database/seeders/DataRowsTableSeeder.php b/database/seeders/DataRowsTableSeeder.php new file mode 100644 index 0000000..262c11d --- /dev/null +++ b/database/seeders/DataRowsTableSeeder.php @@ -0,0 +1,372 @@ +firstOrFail(); + $menuDataType = DataType::where('slug', 'menus')->firstOrFail(); + $roleDataType = DataType::where('slug', 'roles')->firstOrFail(); + + $dataRow = $this->dataRow($userDataType, 'id'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'number', + 'display_name' => __('voyager::seeders.data_rows.id'), + 'required' => 1, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 1, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'name'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'text', + 'display_name' => __('voyager::seeders.data_rows.name'), + 'required' => 1, + 'browse' => 1, + 'read' => 1, + 'edit' => 1, + 'add' => 1, + 'delete' => 1, + 'order' => 2, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'email'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'text', + 'display_name' => __('voyager::seeders.data_rows.email'), + 'required' => 1, + 'browse' => 1, + 'read' => 1, + 'edit' => 1, + 'add' => 1, + 'delete' => 1, + 'order' => 3, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'password'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'password', + 'display_name' => __('voyager::seeders.data_rows.password'), + 'required' => 1, + 'browse' => 0, + 'read' => 0, + 'edit' => 1, + 'add' => 1, + 'delete' => 0, + 'order' => 4, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'remember_token'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'text', + 'display_name' => __('voyager::seeders.data_rows.remember_token'), + 'required' => 0, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 5, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'created_at'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'timestamp', + 'display_name' => __('voyager::seeders.data_rows.created_at'), + 'required' => 0, + 'browse' => 1, + 'read' => 1, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 6, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'updated_at'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'timestamp', + 'display_name' => __('voyager::seeders.data_rows.updated_at'), + 'required' => 0, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 7, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'avatar'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'image', + 'display_name' => __('voyager::seeders.data_rows.avatar'), + 'required' => 0, + 'browse' => 1, + 'read' => 1, + 'edit' => 1, + 'add' => 1, + 'delete' => 1, + 'order' => 8, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'user_belongsto_role_relationship'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'relationship', + 'display_name' => __('voyager::seeders.data_rows.role'), + 'required' => 0, + 'browse' => 1, + 'read' => 1, + 'edit' => 1, + 'add' => 1, + 'delete' => 0, + 'details' => [ + 'model' => 'TCG\\Voyager\\Models\\Role', + 'table' => 'roles', + 'type' => 'belongsTo', + 'column' => 'role_id', + 'key' => 'id', + 'label' => 'display_name', + 'pivot_table' => 'roles', + 'pivot' => 0, + ], + 'order' => 10, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'user_belongstomany_role_relationship'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'relationship', + 'display_name' => __('voyager::seeders.data_rows.roles'), + 'required' => 0, + 'browse' => 1, + 'read' => 1, + 'edit' => 1, + 'add' => 1, + 'delete' => 0, + 'details' => [ + 'model' => 'TCG\\Voyager\\Models\\Role', + 'table' => 'roles', + 'type' => 'belongsToMany', + 'column' => 'id', + 'key' => 'id', + 'label' => 'display_name', + 'pivot_table' => 'user_roles', + 'pivot' => '1', + 'taggable' => '0', + ], + 'order' => 11, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'settings'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'hidden', + 'display_name' => 'Settings', + 'required' => 0, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 12, + ])->save(); + } + + $dataRow = $this->dataRow($menuDataType, 'id'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'number', + 'display_name' => __('voyager::seeders.data_rows.id'), + 'required' => 1, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 1, + ])->save(); + } + + $dataRow = $this->dataRow($menuDataType, 'name'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'text', + 'display_name' => __('voyager::seeders.data_rows.name'), + 'required' => 1, + 'browse' => 1, + 'read' => 1, + 'edit' => 1, + 'add' => 1, + 'delete' => 1, + 'order' => 2, + ])->save(); + } + + $dataRow = $this->dataRow($menuDataType, 'created_at'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'timestamp', + 'display_name' => __('voyager::seeders.data_rows.created_at'), + 'required' => 0, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 3, + ])->save(); + } + + $dataRow = $this->dataRow($menuDataType, 'updated_at'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'timestamp', + 'display_name' => __('voyager::seeders.data_rows.updated_at'), + 'required' => 0, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 4, + ])->save(); + } + + $dataRow = $this->dataRow($roleDataType, 'id'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'number', + 'display_name' => __('voyager::seeders.data_rows.id'), + 'required' => 1, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 1, + ])->save(); + } + + $dataRow = $this->dataRow($roleDataType, 'name'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'text', + 'display_name' => __('voyager::seeders.data_rows.name'), + 'required' => 1, + 'browse' => 1, + 'read' => 1, + 'edit' => 1, + 'add' => 1, + 'delete' => 1, + 'order' => 2, + ])->save(); + } + + $dataRow = $this->dataRow($roleDataType, 'created_at'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'timestamp', + 'display_name' => __('voyager::seeders.data_rows.created_at'), + 'required' => 0, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 3, + ])->save(); + } + + $dataRow = $this->dataRow($roleDataType, 'updated_at'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'timestamp', + 'display_name' => __('voyager::seeders.data_rows.updated_at'), + 'required' => 0, + 'browse' => 0, + 'read' => 0, + 'edit' => 0, + 'add' => 0, + 'delete' => 0, + 'order' => 4, + ])->save(); + } + + $dataRow = $this->dataRow($roleDataType, 'display_name'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'text', + 'display_name' => __('voyager::seeders.data_rows.display_name'), + 'required' => 1, + 'browse' => 1, + 'read' => 1, + 'edit' => 1, + 'add' => 1, + 'delete' => 1, + 'order' => 5, + ])->save(); + } + + $dataRow = $this->dataRow($userDataType, 'role_id'); + if (!$dataRow->exists) { + $dataRow->fill([ + 'type' => 'text', + 'display_name' => __('voyager::seeders.data_rows.role'), + 'required' => 1, + 'browse' => 1, + 'read' => 1, + 'edit' => 1, + 'add' => 1, + 'delete' => 1, + 'order' => 9, + ])->save(); + } + } + + /** + * [dataRow description]. + * + * @param [type] $type [description] + * @param [type] $field [description] + * + * @return [type] [description] + */ + protected function dataRow($type, $field) + { + return DataRow::firstOrNew([ + 'data_type_id' => $type->id, + 'field' => $field, + ]); + } +} diff --git a/database/seeders/DataTypesTableSeeder.php b/database/seeders/DataTypesTableSeeder.php new file mode 100644 index 0000000..52fa50e --- /dev/null +++ b/database/seeders/DataTypesTableSeeder.php @@ -0,0 +1,71 @@ +dataType('slug', 'users'); + if (!$dataType->exists) { + $dataType->fill([ + 'name' => 'users', + 'display_name_singular' => __('voyager::seeders.data_types.user.singular'), + 'display_name_plural' => __('voyager::seeders.data_types.user.plural'), + 'icon' => 'voyager-person', + 'model_name' => 'TCG\\Voyager\\Models\\User', + 'policy_name' => 'TCG\\Voyager\\Policies\\UserPolicy', + 'controller' => 'TCG\\Voyager\\Http\\Controllers\\VoyagerUserController', + 'generate_permissions' => 1, + 'description' => '', + ])->save(); + } + + $dataType = $this->dataType('slug', 'menus'); + if (!$dataType->exists) { + $dataType->fill([ + 'name' => 'menus', + 'display_name_singular' => __('voyager::seeders.data_types.menu.singular'), + 'display_name_plural' => __('voyager::seeders.data_types.menu.plural'), + 'icon' => 'voyager-list', + 'model_name' => 'TCG\\Voyager\\Models\\Menu', + 'controller' => '', + 'generate_permissions' => 1, + 'description' => '', + ])->save(); + } + + $dataType = $this->dataType('slug', 'roles'); + if (!$dataType->exists) { + $dataType->fill([ + 'name' => 'roles', + 'display_name_singular' => __('voyager::seeders.data_types.role.singular'), + 'display_name_plural' => __('voyager::seeders.data_types.role.plural'), + 'icon' => 'voyager-lock', + 'model_name' => 'TCG\\Voyager\\Models\\Role', + 'controller' => 'TCG\\Voyager\\Http\\Controllers\\VoyagerRoleController', + 'generate_permissions' => 1, + 'description' => '', + ])->save(); + } + } + + /** + * [dataType description]. + * + * @param [type] $field [description] + * @param [type] $for [description] + * + * @return [type] [description] + */ + protected function dataType($field, $for) + { + return DataType::firstOrNew([$field => $for]); + } +} diff --git a/database/seeders/MenuItemsTableSeeder.php b/database/seeders/MenuItemsTableSeeder.php new file mode 100644 index 0000000..bd1c797 --- /dev/null +++ b/database/seeders/MenuItemsTableSeeder.php @@ -0,0 +1,179 @@ +firstOrFail(); + + $menuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.dashboard'), + 'url' => '', + 'route' => 'voyager.dashboard', + ]); + if (!$menuItem->exists) { + $menuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-boat', + 'color' => null, + 'parent_id' => null, + 'order' => 1, + ])->save(); + } + + $menuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.media'), + 'url' => '', + 'route' => 'voyager.media.index', + ]); + if (!$menuItem->exists) { + $menuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-images', + 'color' => null, + 'parent_id' => null, + 'order' => 5, + ])->save(); + } + + $menuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.users'), + 'url' => '', + 'route' => 'voyager.users.index', + ]); + if (!$menuItem->exists) { + $menuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-person', + 'color' => null, + 'parent_id' => null, + 'order' => 3, + ])->save(); + } + + $menuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.roles'), + 'url' => '', + 'route' => 'voyager.roles.index', + ]); + if (!$menuItem->exists) { + $menuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-lock', + 'color' => null, + 'parent_id' => null, + 'order' => 2, + ])->save(); + } + + $toolsMenuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.tools'), + 'url' => '', + ]); + if (!$toolsMenuItem->exists) { + $toolsMenuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-tools', + 'color' => null, + 'parent_id' => null, + 'order' => 9, + ])->save(); + } + + $menuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.menu_builder'), + 'url' => '', + 'route' => 'voyager.menus.index', + ]); + if (!$menuItem->exists) { + $menuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-list', + 'color' => null, + 'parent_id' => $toolsMenuItem->id, + 'order' => 10, + ])->save(); + } + + $menuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.database'), + 'url' => '', + 'route' => 'voyager.database.index', + ]); + if (!$menuItem->exists) { + $menuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-data', + 'color' => null, + 'parent_id' => $toolsMenuItem->id, + 'order' => 11, + ])->save(); + } + + $menuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.compass'), + 'url' => '', + 'route' => 'voyager.compass.index', + ]); + if (!$menuItem->exists) { + $menuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-compass', + 'color' => null, + 'parent_id' => $toolsMenuItem->id, + 'order' => 12, + ])->save(); + } + + $menuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.bread'), + 'url' => '', + 'route' => 'voyager.bread.index', + ]); + if (!$menuItem->exists) { + $menuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-bread', + 'color' => null, + 'parent_id' => $toolsMenuItem->id, + 'order' => 13, + ])->save(); + } + + $menuItem = MenuItem::firstOrNew([ + 'menu_id' => $menu->id, + 'title' => __('voyager::seeders.menu_items.settings'), + 'url' => '', + 'route' => 'voyager.settings.index', + ]); + if (!$menuItem->exists) { + $menuItem->fill([ + 'target' => '_self', + 'icon_class' => 'voyager-settings', + 'color' => null, + 'parent_id' => null, + 'order' => 14, + ])->save(); + } + } +} diff --git a/database/seeders/MenusTableSeeder.php b/database/seeders/MenusTableSeeder.php new file mode 100644 index 0000000..9ce5d18 --- /dev/null +++ b/database/seeders/MenusTableSeeder.php @@ -0,0 +1,21 @@ + 'admin', + ]); + } +} diff --git a/database/seeders/PermissionRoleTableSeeder.php b/database/seeders/PermissionRoleTableSeeder.php new file mode 100644 index 0000000..21b529f --- /dev/null +++ b/database/seeders/PermissionRoleTableSeeder.php @@ -0,0 +1,26 @@ +firstOrFail(); + + $permissions = Permission::all(); + + $role->permissions()->sync( + $permissions->pluck('id')->all() + ); + } +} diff --git a/database/seeders/PermissionsTableSeeder.php b/database/seeders/PermissionsTableSeeder.php new file mode 100644 index 0000000..541f5f1 --- /dev/null +++ b/database/seeders/PermissionsTableSeeder.php @@ -0,0 +1,38 @@ + $key, + 'table_name' => null, + ]); + } + + Permission::generateFor('menus'); + + Permission::generateFor('roles'); + + Permission::generateFor('users'); + + Permission::generateFor('settings'); + } +} diff --git a/database/seeders/RolesTableSeeder.php b/database/seeders/RolesTableSeeder.php new file mode 100644 index 0000000..dc08497 --- /dev/null +++ b/database/seeders/RolesTableSeeder.php @@ -0,0 +1,29 @@ + 'admin']); + if (!$role->exists) { + $role->fill([ + 'display_name' => __('voyager::seeders.roles.admin'), + ])->save(); + } + + $role = Role::firstOrNew(['name' => 'user']); + if (!$role->exists) { + $role->fill([ + 'display_name' => __('voyager::seeders.roles.user'), + ])->save(); + } + } +} diff --git a/database/seeders/SettingsTableSeeder.php b/database/seeders/SettingsTableSeeder.php new file mode 100644 index 0000000..09b27bc --- /dev/null +++ b/database/seeders/SettingsTableSeeder.php @@ -0,0 +1,147 @@ +findSetting('site.title'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.site.title'), + 'value' => __('voyager::seeders.settings.site.title'), + 'details' => '', + 'type' => 'text', + 'order' => 1, + 'group' => 'Site', + ])->save(); + } + + $setting = $this->findSetting('site.description'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.site.description'), + 'value' => __('voyager::seeders.settings.site.description'), + 'details' => '', + 'type' => 'text', + 'order' => 2, + 'group' => 'Site', + ])->save(); + } + + $setting = $this->findSetting('site.logo'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.site.logo'), + 'value' => '', + 'details' => '', + 'type' => 'image', + 'order' => 3, + 'group' => 'Site', + ])->save(); + } + + $setting = $this->findSetting('site.google_analytics_tracking_id'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.site.google_analytics_tracking_id'), + 'value' => '', + 'details' => '', + 'type' => 'text', + 'order' => 4, + 'group' => 'Site', + ])->save(); + } + + $setting = $this->findSetting('admin.bg_image'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.admin.background_image'), + 'value' => '', + 'details' => '', + 'type' => 'image', + 'order' => 5, + 'group' => 'Admin', + ])->save(); + } + + $setting = $this->findSetting('admin.title'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.admin.title'), + 'value' => 'Voyager', + 'details' => '', + 'type' => 'text', + 'order' => 1, + 'group' => 'Admin', + ])->save(); + } + + $setting = $this->findSetting('admin.description'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.admin.description'), + 'value' => __('voyager::seeders.settings.admin.description_value'), + 'details' => '', + 'type' => 'text', + 'order' => 2, + 'group' => 'Admin', + ])->save(); + } + + $setting = $this->findSetting('admin.loader'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.admin.loader'), + 'value' => '', + 'details' => '', + 'type' => 'image', + 'order' => 3, + 'group' => 'Admin', + ])->save(); + } + + $setting = $this->findSetting('admin.icon_image'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.admin.icon_image'), + 'value' => '', + 'details' => '', + 'type' => 'image', + 'order' => 4, + 'group' => 'Admin', + ])->save(); + } + + $setting = $this->findSetting('admin.google_analytics_client_id'); + if (!$setting->exists) { + $setting->fill([ + 'display_name' => __('voyager::seeders.settings.admin.google_analytics_client_id'), + 'value' => '', + 'details' => '', + 'type' => 'text', + 'order' => 1, + 'group' => 'Admin', + ])->save(); + } + } + + /** + * [setting description]. + * + * @param [type] $key [description] + * + * @return [type] [description] + */ + protected function findSetting($key) + { + return Setting::firstOrNew(['key' => $key]); + } +} diff --git a/database/seeders/TranslationsTableSeeder.php b/database/seeders/TranslationsTableSeeder.php new file mode 100644 index 0000000..fff73d3 --- /dev/null +++ b/database/seeders/TranslationsTableSeeder.php @@ -0,0 +1,233 @@ +dataTypesTranslations(); + $this->categoriesTranslations(); + $this->pagesTranslations(); + $this->menusTranslations(); + } + + /** + * Auto generate Categories Translations. + * + * @return void + */ + private function categoriesTranslations() + { + // Adding translations for 'categories' + // + $cat = Category::where('slug', 'category-1')->firstOrFail(); + if ($cat->exists) { + $this->trans('pt', $this->arr(['categories', 'slug'], $cat->id), 'categoria-1'); + $this->trans('pt', $this->arr(['categories', 'name'], $cat->id), 'Categoria 1'); + } + $cat = Category::where('slug', 'category-2')->firstOrFail(); + if ($cat->exists) { + $this->trans('pt', $this->arr(['categories', 'slug'], $cat->id), 'categoria-2'); + $this->trans('pt', $this->arr(['categories', 'name'], $cat->id), 'Categoria 2'); + } + } + + /** + * Auto generate DataTypes Translations. + * + * @return void + */ + private function dataTypesTranslations() + { + // Adding translations for 'display_name_singular' + // + $_fld = 'display_name_singular'; + $_tpl = ['data_types', $_fld]; + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.post.singular'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Post'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.page.singular'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Página'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.user.singular'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Utilizador'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.category.singular'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Categoria'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.menu.singular'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Menu'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.role.singular'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Função'); + } + + // Adding translations for 'display_name_plural' + // + $_fld = 'display_name_plural'; + $_tpl = ['data_types', $_fld]; + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.post.plural'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Posts'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.page.plural'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Páginas'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.user.plural'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Utilizadores'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.category.plural'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Categorias'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.menu.plural'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Menus'); + } + $dtp = DataType::where($_fld, __('voyager::seeders.data_types.role.plural'))->firstOrFail(); + if ($dtp->exists) { + $this->trans('pt', $this->arr($_tpl, $dtp->id), 'Funções'); + } + } + + /** + * Auto generate Pages Translations. + * + * @return void + */ + private function pagesTranslations() + { + $page = Page::where('slug', 'hello-world')->firstOrFail(); + if ($page->exists) { + $_arr = $this->arr(['pages', 'title'], $page->id); + $this->trans('pt', $_arr, 'Olá Mundo'); + /** + * For configuring additional languages use it e.g. + * + * ``` + * $this->trans('es', $_arr, 'hola-mundo'); + * $this->trans('de', $_arr, 'hallo-welt'); + * ``` + */ + $_arr = $this->arr(['pages', 'slug'], $page->id); + $this->trans('pt', $_arr, 'ola-mundo'); + + $_arr = $this->arr(['pages', 'body'], $page->id); + $this->trans('pt', $_arr, '

Olá Mundo. Scallywag grog swab Cat o\'nine tails scuttle rigging hardtack cable nipper Yellow Jack. Handsomely spirits knave lad killick landlubber or just lubber deadlights chantey pinnace crack Jennys tea cup. Provost long clothes black spot Yellow Jack bilged on her anchor league lateen sail case shot lee tackle.

' + ."\r\n".'

Ballast spirits fluke topmast me quarterdeck schooner landlubber or just lubber gabion belaying pin. Pinnace stern galleon starboard warp carouser to go on account dance the hempen jig jolly boat measured fer yer chains. Man-of-war fire in the hole nipperkin handsomely doubloon barkadeer Brethren of the Coast gibbet driver squiffy.

'); + } + } + + /** + * Auto generate Menus Translations. + * + * @return void + */ + private function menusTranslations() + { + $_tpl = ['menu_items', 'title']; + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.dashboard')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Painel de Controle'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.media')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Media'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.posts')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Publicações'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.users')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Utilizadores'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.categories')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Categorias'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.pages')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Páginas'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.roles')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Funções'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.tools')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Ferramentas'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.menu_builder')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Menus'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.database')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Base de dados'); + } + + $_item = $this->findMenuItem(__('voyager::seeders.menu_items.settings')); + if ($_item->exists) { + $this->trans('pt', $this->arr($_tpl, $_item->id), 'Configurações'); + } + } + + private function findMenuItem($title) + { + return MenuItem::where('title', $title)->firstOrFail(); + } + + private function arr($par, $id) + { + return [ + 'table_name' => $par[0], + 'column_name' => $par[1], + 'foreign_key' => $id, + ]; + } + + private function trans($lang, $keys, $value) + { + $_t = Translation::firstOrNew(array_merge($keys, [ + 'locale' => $lang, + ])); + + if (!$_t->exists) { + $_t->fill(array_merge( + $keys, + ['value' => $value] + ))->save(); + } + } +} diff --git a/database/seeders/VoyagerDatabaseSeeder.php b/database/seeders/VoyagerDatabaseSeeder.php new file mode 100644 index 0000000..fc991b8 --- /dev/null +++ b/database/seeders/VoyagerDatabaseSeeder.php @@ -0,0 +1,27 @@ +call([ + DataTypesTableSeeder::class, + DataRowsTableSeeder::class, + MenusTableSeeder::class, + MenuItemsTableSeeder::class, + RolesTableSeeder::class, + PermissionsTableSeeder::class, + PermissionRoleTableSeeder::class, + SettingsTableSeeder::class, + ]); + } +} diff --git a/database/seeders/VoyagerDummyDatabaseSeeder.php b/database/seeders/VoyagerDummyDatabaseSeeder.php new file mode 100644 index 0000000..88173b5 --- /dev/null +++ b/database/seeders/VoyagerDummyDatabaseSeeder.php @@ -0,0 +1,25 @@ +call([ + CategoriesTableSeeder::class, + UsersTableSeeder::class, + PostsTableSeeder::class, + PagesTableSeeder::class, + TranslationsTableSeeder::class, + PermissionRoleTableSeeder::class, + ]); + } +} diff --git a/package-lock.json b/package-lock.json index b5d825a..77fb376 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "new.site", + "name": "New-site", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/routes/web.php b/routes/web.php index 0a4a1d9..15cfac7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,7 +1,6 @@ 'admin'], function () { + Voyager::routes(); +});