我正在创建一个管理面板,管理员可以编辑,删除用户,用户只能看到仪表板和主页。在主页上,我有用户配置文件和编辑按钮。问题是用户看不到编辑页面。我已经创建了另一个页面,如用户编辑,但用户无法访问它。家.刀片.php<div class="container"> <h1 class="my-4">Your Profile</h1> <div class="row"> <div class="col-md-8"> <img class="profile-image-page mr-md-3" src="{{ (isset(Auth::user()->github_id)) ? (Auth::user()->avatar) : (asset('images/avatars/' . Auth::user()->avatar)) }}" alt="{{ Auth::user()->name}}"> </div> <div class="col-md-4"> <h3 class="my-3">Account</h3> <ul> <li><b>ID: </b>{{ Auth::user()->id }}</li><hr> <li><b>Name: </b>{{ Auth::user()->name }}</li><hr> <li><b>Last Name: </b>{{ Auth::user()->lastname }}</li><hr> <li><b>Email: </b>{{ Auth::user()->email }}</li><hr> <li><b>Phone: </b>{{ Auth::user()->phone }}</li><hr> <li><b>Job Title: </b>{{ Auth::user()->jobtitle }}</li><hr> <li><b>Department: </b>{{ Auth::user()->department}}</li><hr> <a href="/role-edit/{{ Auth::user()->id }}" class="btn btn-success">EDIT</a> </ul> </div> </div>网站.php<?phpuse App\User;use App\Department;/*|--------------------------------------------------------------------------| Web Routes|--------------------------------------------------------------------------|| Here is where you can register web routes for your application. These| routes are loaded by the RouteServiceProvider within a group which| contains the "web" middleware group. Now create something great!|*/Route::get('/', function () { return view('welcome');});Route::get('/page', function () { return view('admin.page');});});
1 回答
汪汪一只猫
TA贡献1898条经验 获得超8个赞
该路由使用中间件,这可能意味着只有管理员才能访问它。admin
Route::group(['middleware' => ['auth','admin']], function () {
...
Route::get('/user-edit/{id}', 'HomeController@registeredit');
});
只需搬到外面:
Route::group(['middleware' => ['auth','admin']], function () {
...
});
Route::get('/user-edit/{id}', 'HomeController@registeredit');
- 1 回答
- 0 关注
- 82 浏览
添加回答
举报
0/150
提交
取消