【发布时间】:2016-08-11 19:15:06
【问题描述】:
我正在创建一个名为医生管理系统的项目。我现在陷入困境,当用户登录他的页面时,我的路由功能会获取特定的 ID,然后显示他的信息。但是当我登录时它没有得到 id 这就是为什么它会出现一些错误但是当我手动输入 id 时它工作得很好。我没有找到为什么会发生这种情况。请大家帮帮我。
我的路线文件
Route::group([
'middleware' => 'auth'
], function() {
Route::get('/home/{profile_id}', [
'as' => 'admin',
'uses' => 'AdminController@index'
]);
Route::get('/profile/{profile_id}', array('as' =>'profile' ,'uses' => 'ProfileController@index'));
我的个人资料管理员是
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\User;
class ProfileController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index($profile_id)
{
$profile = User::find($profile_id);
// if(!$profile) {
// return redirect()->route('logout')->with(['fail' => 'Profile Not Found']);
// }
return view('admin.article.index',['profile' => $profile]);
}
【问题讨论】:
标签: php mysql laravel routes laravel-5.1