🍻 Remet en place la logique de maj

This commit is contained in:
Clement Desmidt 2017-11-20 15:29:48 +01:00
parent c52a163a55
commit eda18e25e8

View File

@ -58,12 +58,14 @@ class HomeController extends Controller
}
if ($request->isMethod('post')) {
// TODO filter
$deal
->setSubject($request->subject)
->setBody($request->body)
->setCategory($request->category)
->setPrice($request->price);
$deal->save($folder_path);
$updated_deal = \Shikiryu\LBCReposter\Deal::fromJSON($folder_path . '/data.json');
$result =
$updated_deal
->setSubject($request->subject)
->setBody($request->body)
->setCategory($request->category)
->setPrice($request->price)
->save($folder_path);
return redirect()->route('deals.list', ['type' => $type])->with('status', ($result ? 'Deal mis à jour': 'ERREUR'));
}
return view('update', ['deal' => $deal, 'type' => $type]);