I am creating a project called doctor management system. I am now stuck in this that when a user logged in his page my route function get the specific id & then show his information. But when I logged in it did not get id & that's why it put some error but When I manuaaly enter the id it worked perfectly ok. I did not find why this occurs. Please Guys Help Me.
My Route File
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'));
My profile Controler is
<?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]);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire