Skip to content

Commit f4567db

Browse files
authored
Merge pull request #139 from igorsantos07/standalone-routes
Standalone routes
2 parents acda0b0 + f6beaac commit f4567db

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/Config/quickadmin.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
//Default home action
2424
// 'homeAction' => '\App\Http\Controllers\MyOwnController@index',
2525
// Default role to access users and CRUD
26-
'defaultRole' => 1
26+
'defaultRole' => 1,
2727

28-
];
28+
// If set to true, you'll need to copy the routes
29+
// from vendor/laraveldaily/quickadmin/src/routes.php into your own /routes folder
30+
'standaloneRoutes' => false,
31+
32+
// Used to define relationship with UserLogs
33+
'userModel' => \App\User::class
34+
35+
];

src/Models/UsersLogs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class UsersLogs extends Model
1414

1515
public function users()
1616
{
17-
return $this->hasOne('App\User', 'id', 'user_id');
17+
return $this->hasOne(config('quickadmin.userModel'), 'id', 'user_id');
1818
}
19-
}
19+
}

src/routes.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
use Illuminate\Support\Facades\View;
88
use Laraveldaily\Quickadmin\Models\Menu;
99

10+
if (config('quickadmin.standaloneRoutes')) {
11+
return;
12+
}
13+
1014
if (Schema::hasTable('menus')) {
1115
$menus = Menu::with('children')->where('menu_type', '!=', 0)->orderBy('position')->get();
1216
View::share('menus', $menus);
@@ -105,7 +109,6 @@
105109
});
106110
});
107111

108-
// @todo move to default routes.php
109112
Route::group([
110113
'namespace' => 'App\Http\Controllers',
111114
'middleware' => ['web']

0 commit comments

Comments
 (0)