dimanche 6 août 2017

Redirect from one page to another in Laravel based off of ID

This is not working in my Laravel. I want to make each list able to be redirected to another page using the ID.

viewps.blade.php:

@foreach ($ps as $ps )
    <li>
    <li></li>
@endforeach

Routes:

Route::get('/viewps', 'PsController@show');
Route::get('/viewps/{id}', 'PsController@view')->name('viewps');
Route::get('/home', 'HomeController@index')->name('home');

pscontroller:

public function show()
{
    $ps = DB::table('ps')->get();
    return view('viewps', ['ps' => $ps]);
}

public function view($id)
{
    $ps = Ps::find($id);

    // show the view and pass to it
    return view ('view')->with('ps', $ps);
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2vaNOmY
via IFTTT

Aucun commentaire:

Enregistrer un commentaire