I can't figure out why it isnt working, i have a page to manage user role, and the only way that i can access my user role page is through browser. I mean.. if i do a view route like that, it just dont work. (Only for role.user). role.index and role.create are working just fine.
I've read about resources and such.. I just dont get it. How can i solve that error. And is there a better way to do it?
my app.blade.php for extends:
<div class="container">
<nav class="navbar navbar-light">
<a class="navbar-brand" href="">Permissão</a>
<a class="navbar-brand" href="">Criar Permissão</a>
<a class="navbar-brand" href="">Editar Usuário</a>
</nav>
@yield("content")
and i defined it in my web.php route as resource:
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/admin', ['as'=>'admin', 'middleware'=>'role:administrador','uses'=> function(){
return view ('admin.index');
}
]);
Route::resource ('role', 'RoleController');
Route::resource ('user', 'UserController');
My UserController:
namespace App\Http\Controllers;
use App\User;
use App\Role;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class UserController extends Controller
{
public function index()
{
$users = User::all();
$allRoles = Role::all();
return view('admin.role.user', compact(['users','allRoles']));
}
error:
"Route [role.user] not defined. (View: C:\xampp\htdocs\cms\resources\views\adminLayout\app.blade.php) (View: C:\xampp\htdocs\cms\resources\views\adminLayout\app.blade.php)"
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire