我正在創建一個名爲醫生管理系統的項目。我現在陷入了這種情況,當用戶登錄他的頁面我的路由功能得到具體的ID &然後顯示他的信息。但是,當我登錄它沒有得到編號&這就是爲什麼它會發生一些錯誤,但當我manuaaly輸入ID它工作完全正常。我沒有找到爲什麼會發生這種情況。請幫助我。路由ID不工作
我的路由文件
Route::group([
'middleware' => 'auth'
], function() {
Route::get('/home/{profile_id}', [
'as' => 'admin',
'uses' => '[email protected]'
]);
Route::get('/profile/{profile_id}', array('as' =>'profile' ,'uses' => '[email protected]'));
我的個人資料的Controler是
<?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]);
}
Tnx爲您的幫助。它解決了我的問題 –
不客氣! – harrysbaraini
如何使用此表示法更新我的個人檔案文件中的任何信息? –