Добавил и настроил админку Voyager
Some checks failed
Gitea Actions / Build and deploy (push) Failing after 44s

This commit is contained in:
Dhaverd 2024-03-22 00:53:29 +08:00
parent 788027b9a3
commit aa9e28fd06
24 changed files with 2166 additions and 15 deletions

View File

@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class GamesController extends Controller
{
//
}

View File

@ -12,8 +12,8 @@ class SchedulesController extends Controller
{ {
public function index(){ public function index(){
$finalSchedules = DB::table('schedules') $finalSchedules = DB::table('schedules')
->join('weekdays', "schedules.weekday_id", "=", "weekdays.weekday_id") ->join('weekdays', "schedules.weekday_id", "=", "weekdays.id")
->join("games", "schedules.game_id", "=", "games.game_id") ->join("games", "schedules.game_id", "=", "games.id")
->select("weekdays.weekday_name", "weekdays.current_date", "games.name", "schedules.stream_time") ->select("weekdays.weekday_name", "weekdays.current_date", "games.name", "schedules.stream_time")
->get(); ->get();
return $finalSchedules; return $finalSchedules;
@ -21,8 +21,8 @@ class SchedulesController extends Controller
public function mmDate(){ public function mmDate(){
$minmaxDates = DB::table("weekdays") $minmaxDates = DB::table("weekdays")
->select("weekdays.current_date")->where("weekday_id", "=", 1) ->select("weekdays.current_date")->where("weekdays.id", "=", 1)
->orWhere("weekday_id", "=", 7) ->orWhere("weekdays.id", "=", 7)
->get(); ->get();
return $minmaxDates; return $minmaxDates;
} }

View File

@ -8,7 +8,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens; use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable class User extends \TCG\Voyager\Models\User
{ {
use HasApiTokens, HasFactory, Notifiable; use HasApiTokens, HasFactory, Notifiable;

View File

@ -9,7 +9,8 @@
"guzzlehttp/guzzle": "^7.2", "guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10", "laravel/framework": "^10.10",
"laravel/sanctum": "^3.3", "laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8" "laravel/tinker": "^2.8",
"tcg/voyager": "^1.7"
}, },
"require-dev": { "require-dev": {
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",

692
composer.lock generated
View File

@ -4,8 +4,76 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "9c491b8531eec05ba41a11d9276a5749", "content-hash": "fb6ec7f789fc4935dd4bcecfe448f15d",
"packages": [ "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", "name": "brick/math",
"version": "0.11.0", "version": "0.11.0",
@ -205,6 +273,350 @@
}, },
"time": "2022-10-27T11:44:00+00:00" "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", "name": "doctrine/inflector",
"version": "2.0.9", "version": "2.0.9",
@ -1045,6 +1457,90 @@
], ],
"time": "2023-12-03T19:50:20+00:00" "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", "name": "laravel/framework",
"version": "v10.41.0", "version": "v10.41.0",
@ -1499,6 +1995,68 @@
}, },
"time": "2024-01-04T16:10:04+00:00" "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", "name": "league/commonmark",
"version": "2.4.1", "version": "2.4.1",
@ -2468,6 +3026,55 @@
], ],
"time": "2023-11-12T21:59:55+00:00" "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", "name": "psr/clock",
"version": "1.0.0", "version": "1.0.0",
@ -5441,6 +6048,89 @@
], ],
"time": "2023-12-28T19:16:56+00:00" "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", "name": "tijsverkoyen/css-to-inline-styles",
"version": "v2.2.7", "version": "v2.2.7",

20
config/image.php Normal file
View File

@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Image Driver
|--------------------------------------------------------------------------
|
| Intervention Image supports "GD Library" and "Imagick" to process images
| internally. You may choose one of them according to your PHP
| configuration. By default PHP's "GD Library" implementation is used.
|
| Supported: "gd", "imagick"
|
*/
'driver' => 'gd'
];

258
config/voyager.php Normal file
View File

@ -0,0 +1,258 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| User config
|--------------------------------------------------------------------------
|
| Here you can specify voyager user configs
|
*/
'user' => [
'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
],
]*/
],
];

View File

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::create('links', function (Blueprint $table) { Schema::create('links', function (Blueprint $table) {
$table->id('link_id'); $table->id('id');
$table->text("link_name"); $table->text("link_name");
$table->text("link"); $table->text("link");
$table->text("image"); $table->text("image");

View File

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::create('weekdays', function (Blueprint $table) { Schema::create('weekdays', function (Blueprint $table) {
$table->id("weekday_id"); $table->id("id");
$table->text("weekday_name"); $table->text("weekday_name");
$table->date("current_date"); $table->date("current_date");
}); });

View File

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::create('games', function (Blueprint $table) { Schema::create('games', function (Blueprint $table) {
$table->id("game_id"); $table->id("id");
$table->text("name"); $table->text("name");
}); });
} }

View File

@ -12,12 +12,12 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::create('schedules', function (Blueprint $table) { Schema::create('schedules', function (Blueprint $table) {
$table->id("schedule_id"); $table->id("id");
$table->foreignId("weekday_id")->constrained( $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->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"); $table->text("stream_time");
}); });

View File

@ -0,0 +1,372 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\DataRow;
use TCG\Voyager\Models\DataType;
class DataRowsTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*/
public function run()
{
$userDataType = DataType::where('slug', 'users')->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,
]);
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\DataType;
class DataTypesTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*/
public function run()
{
$dataType = $this->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]);
}
}

View File

@ -0,0 +1,179 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\Menu;
use TCG\Voyager\Models\MenuItem;
class MenuItemsTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*
* @return void
*/
public function run()
{
$menu = Menu::where('name', 'admin')->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();
}
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\Menu;
class MenusTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*
* @return void
*/
public function run()
{
Menu::firstOrCreate([
'name' => 'admin',
]);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\Permission;
use TCG\Voyager\Models\Role;
class PermissionRoleTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*
* @return void
*/
public function run()
{
$role = Role::where('name', 'admin')->firstOrFail();
$permissions = Permission::all();
$role->permissions()->sync(
$permissions->pluck('id')->all()
);
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\Permission;
class PermissionsTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*/
public function run()
{
$keys = [
'browse_admin',
'browse_bread',
'browse_database',
'browse_media',
'browse_compass',
];
foreach ($keys as $key) {
Permission::firstOrCreate([
'key' => $key,
'table_name' => null,
]);
}
Permission::generateFor('menus');
Permission::generateFor('roles');
Permission::generateFor('users');
Permission::generateFor('settings');
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\Role;
class RolesTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*/
public function run()
{
$role = Role::firstOrNew(['name' => '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();
}
}
}

View File

@ -0,0 +1,147 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\Setting;
class SettingsTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*/
public function run()
{
$setting = $this->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]);
}
}

View File

@ -0,0 +1,233 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\Category;
use TCG\Voyager\Models\DataType;
use TCG\Voyager\Models\MenuItem;
use TCG\Voyager\Models\Page;
use TCG\Voyager\Models\Translation;
class TranslationsTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*
* @return void
*/
public function run()
{
$this->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, '<p>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.</p>'
."\r\n".'<p>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.</p>');
}
}
/**
* 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();
}
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class VoyagerDatabaseSeeder extends Seeder
{
/**
* Run the database seeders.
*
* @return void
*/
public function run()
{
$this->call([
DataTypesTableSeeder::class,
DataRowsTableSeeder::class,
MenusTableSeeder::class,
MenuItemsTableSeeder::class,
RolesTableSeeder::class,
PermissionsTableSeeder::class,
PermissionRoleTableSeeder::class,
SettingsTableSeeder::class,
]);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class VoyagerDummyDatabaseSeeder extends Seeder
{
/**
* Run the database seeders.
*
* @return void
*/
public function run()
{
$this->call([
CategoriesTableSeeder::class,
UsersTableSeeder::class,
PostsTableSeeder::class,
PagesTableSeeder::class,
TranslationsTableSeeder::class,
PermissionRoleTableSeeder::class,
]);
}
}

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{ {
"name": "new.site", "name": "New-site",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@ -1,7 +1,6 @@
<?php <?php
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Http\Controllers\DownloadController;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -27,3 +26,8 @@ Route::get('/resume', function () {
}); });
Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download'); Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download');
Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
});