This question already has an answer here:
The problem is on this function, on the '->' of the line number 52 but i dont understand why. any help?
public function store(StoreMovement $request)
{
$movement = new Movement($request->all());
$movement->money = $request->get('money_decimal') * 100;
$category = $request->get('category_id');
if(!is_numeric($category)){
$newCategory = Category::firstOrCreate(['name' => ucwords($category)]);
$movement->category_id = $newCategory->id;
}
$movement->user_id = auth()->user()->id;
if ($request)->hasFile('image')) {
$image = $request->file('image');
$file = $image->store('images/movements');
$movement->image = $file;
}
$movement->save();
return redirect()->route('movements.show', $movement);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire