Skip to content

Commit

Permalink
Merge pull request #139 from igorsantos07/standalone-routes
Browse files Browse the repository at this point in the history
Standalone routes
  • Loading branch information
PovilasKorop authored May 27, 2018
2 parents acda0b0 + f6beaac commit f4567db
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/Config/quickadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
//Default home action
// 'homeAction' => '\App\Http\Controllers\MyOwnController@index',
// Default role to access users and CRUD
'defaultRole' => 1
'defaultRole' => 1,

];
// If set to true, you'll need to copy the routes
// from vendor/laraveldaily/quickadmin/src/routes.php into your own /routes folder
'standaloneRoutes' => false,

// Used to define relationship with UserLogs
'userModel' => \App\User::class

];
4 changes: 2 additions & 2 deletions src/Models/UsersLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class UsersLogs extends Model

public function users()
{
return $this->hasOne('App\User', 'id', 'user_id');
return $this->hasOne(config('quickadmin.userModel'), 'id', 'user_id');
}
}
}
5 changes: 4 additions & 1 deletion src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
use Illuminate\Support\Facades\View;
use Laraveldaily\Quickadmin\Models\Menu;

if (config('quickadmin.standaloneRoutes')) {
return;
}

if (Schema::hasTable('menus')) {
$menus = Menu::with('children')->where('menu_type', '!=', 0)->orderBy('position')->get();
View::share('menus', $menus);
Expand Down Expand Up @@ -105,7 +109,6 @@
});
});

// @todo move to default routes.php
Route::group([
'namespace' => 'App\Http\Controllers',
'middleware' => ['web']
Expand Down

0 comments on commit f4567db

Please sign in to comment.