I wanted to give laratrust a shot, but I ran into some trouble with the routing. Let me explain in brief, what I did so far. I've created a new laravel app as described in the laravel docs. Then I used the make:auth generator to generate everything needed for standard login/registration. That works great. Now I am on a point, where laratrust kicks in. After installation I did everything as described in the laratrust docs. Additionally I went with DevMarketer's "Build an advanced blog" series on youtube, to get laratrust to work. The problem is now, that a login (i.e. as admin) leads me to https://myapp.local/public/home instead to https://myapp.local/public/admin/dashboard as defined so in the controller. If I edit the url after login to reach the dashboard, it works well and the dash appears. Why not after my login attempt?! Any ideas are welcome. The urls above are just examples. So don't be confused while have a look into my "AdminController":
<?php
namespace App\Http\Controllers;
use App\User;
use app\Role;
use Illuminate\Http\Request;
class AdminController extends Controller
{
public function index()
{
return redirect()->route('administration.dashboard');
}
public function dashboard()
{
return view('backend.dashboard');
}
My routes:
<?php
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
/**
* Admin routes
*/
Route::prefix('administration')->middleware('role:superadministrator|administrator')->group(function () {
Route::get('/', 'AdminController@index');
Route::get('/dashboard', [
'uses' => 'AdminController@dashboard',
'as' => 'administration.dashboard',
]);
});
So, maybe its too late for me and I won't see my mistake. Can anybody help me out? Thanks guys. Good night.