jeudi 30 septembre 2021

Laravel FakeID problem Missing required parameter for Route

i trying to use this package to hide the id of my users, tthe problem is that can't get it to work

https://github.com/Propaganistas/Laravel-FakeId

Error:

Missing required parameter for [Route: perfil] [URI: perfil/{id}] [Missing parameter: id]. 

Route:

Route::get('/perfil/{id}', 'PerfilesController@index')->name('perfil');

Blade:

 <a href="">     <p class="">Jimmy Turner</p> </a>

Controller:

 public function index (Request $request, $id){


  $usuario =  User::where('id', $id)->first();


    $data = [
        'category_name' => 'users',
        'page_name' => 'profile',
        'has_scrollspy' => 0,
        'scrollspy_offset' => '',

    ];
    return view('perfil',compact('usuario'))->with($data);

}

In the User model it is configured with:

use Propaganistas\LaravelFakeId\RoutesWithFakeIds;

 class User extends Authenticatable
{
    use HasApiTokens, HasFactory, Notifiable, RoutesWithFakeIds;

Why can't you find the fake ID?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire