mardi 3 juillet 2018

how to fix Laravel error: Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) [duplicate]

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