このページの翻訳:
- 日本語 (ja)
- English (en)
最近の更新
Tag Cloud
このページへのアクセス
今日: 2 / 昨日: 2
総計: 927
- Dokuwiki.fl8.jp(168)
- 13 CentOS6メール設定(10)
- 02 ProFTPD(9)
- 14 rsync(9)
最近の更新
このページへのアクセス
今日: 2 / 昨日: 2
総計: 927
$ laravel new $ composer require tcg/voyager
config/app.php
'providers' => [ ・ ・ TCG\Voyager\VoyagerServiceProvider::class,
$ php artisan voyager:install --with-dummy
今回Songsモデルを作成している事を前提に説明
$ php artisan make:model Songs
今回の場合、slug-naeがsongsになります。
resources/views/vendor/voyager/[slug-name] 以下にbrose.blade.phpとedit-add.blade.phpを置けばオーバライドされる。
デフォルトのビューをコピーして利用
cp vendor/tcg/voyager/resources/views/bread/browse.blade.php resources/views/vendor/voyager/songs/ cp vendor/tcg/voyager/resources/views/bread/edit-add.blade.php resources/views/vendor/voyager/songs/
vendor/tcg/voyager/resources/views/を全部コピーしておく
$ rsync -av vendor/tcg/voyager/resources/views/ resources/views/vendor/voyager/
$ rsync -av vendor/tcg/voyager/publishable/lang/ja/ resources/lang/vendor/voyager/ja/
config/voyager.phpを修正
config/voyager.php
'controllers' => [ - 'namespace' => 'TCG\\Voyager\\Http\\Controllers', + //'namespace' => 'TCG\\Voyager\\Http\\Controllers', + 'namespace' => 'App\\Http\\Controllers\\Voyager', ],
voyager:controllersを実行
$ php artisan voyager:controllers $ ll app/Http/Controllers/Voyager/ total 44 -rw-r--r-- 1 matsui users 207 Apr 3 10:40 VoyagerAuthController.php -rw-r--r-- 1 matsui users 207 Apr 3 10:40 VoyagerBaseController.php -rw-r--r-- 1 matsui users 211 Apr 3 10:40 VoyagerBreadController.php -rw-r--r-- 1 matsui users 219 Apr 3 10:40 VoyagerCompassController.php -rw-r--r-- 1 matsui users 191 Apr 3 10:40 VoyagerController.php -rw-r--r-- 1 matsui users 223 Apr 3 10:40 VoyagerDatabaseController.php -rw-r--r-- 1 matsui users 211 Apr 3 10:40 VoyagerMediaController.php -rw-r--r-- 1 matsui users 207 Apr 3 10:40 VoyagerMenuController.php -rw-r--r-- 1 matsui users 207 Apr 3 10:40 VoyagerRoleController.php -rw-r--r-- 1 matsui users 223 Apr 3 10:40 VoyagerSettingsController.php -rw-r--r-- 1 matsui users 207 Apr 3 10:40 VoyagerUserController.php
ベースを元にコピーしてきて、namespaceと参照先を変更してやればよい。
# cp vendor/tcg/voyager/src/Http/Controllers/VoyagerBaseController.php app/Http/Controllers/Voyager/SongsController.php
$ diff -u vendor/tcg/voyager/src/Http/Controllers/VoyagerBaseController.php app/Http/Controllers/Voyager/SongsController.php
--- vendor/tcg/voyager/src/Http/Controllers/VoyagerBaseController.php 2019-03-10 03:54:39.000000000 +0900
+++ app/Http/Controllers/Voyager/SongsController.php 2019-04-03 12:32:52.553751402 +0900
@@ -1,6 +1,6 @@
<?php
-namespace TCG\Voyager\Http\Controllers;
+namespace App\Http\Controllers\Voyager;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Http\Request;
@@ -14,7 +14,7 @@
use TCG\Voyager\Facades\Voyager;
use TCG\Voyager\Http\Controllers\Traits\BreadRelationshipParser;
-class VoyagerBaseController extends Controller
+class SongsController extends VoyagerBaseController
{
use BreadRelationshipParser;
routes/web.php
Route::group(['prefix' => 'admin'], function () { Voyager::routes(); Route::get('songs','Voyager\SongsController@index')->name('voyager.songs.index')->middleware('admin.user'); Route::post('songs','Voyager\SongsController@index')->name('voyager.songs.index')->middleware('admin.user'); });