lundi 25 décembre 2017

"Type error: Too few arguments to function App\Http\Controllers\FrontController::detail(), 0 passed and exactly 1 expected"

I want to passing a data from Shirts to details, to know a detail of product from Shirts. How to do that? I have some error here Error's Message

FrontController.php

 class FrontController extends Controller
{
  public function index()
  {
    $shirts=Product::all();
    return view('front.home', compact('shirts'));
  }
  public function shirts()
  {
    $shirts=Product::all();
    return view('front.shirts', compact('shirts'));
  }
  public function detail($id)
  {
      return view('front.shirt', ['detail' => Product::findOrFail($id)]);

  }

Route Web.php

Route::get('/', 'FrontController@index')->name('home');
Route::get('/shirts', 'FrontController@shirts')->name('shirts');
Route::get('/detail', 'FrontController@detail')->name('detail');

Shirts.blade.php

<a href="">



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire