jeudi 12 octobre 2017

Laravel issue with create()

I've just started some tutorial about Laravel and I got some trouble with this code:

 public function store(Request $request )
  {
        $product = $this->validate(request(), [
          'name' => 'required',
          'price' => 'required|numeric'
        ]);
        Product::create($product);
        return back()->with('success', 'Product has been added');
  }

Argument 1 passed to Illuminate\Database\Eloquent\Builder::create() must be of the type array, null given, called in C:\~\laravel\framework\src\Illuminate\Database\Eloquent\Model.php on line 1374 and defined

I have no idea what I did wrong, I'm following this tutorial step by step



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire