Browse Source

:beers: Remet en place la logique de maj

master
Clement Desmidt 1 year ago
parent
commit
eda18e25e8
1 changed files with 8 additions and 6 deletions
  1. 8
    6
      app/Http/Controllers/HomeController.php

+ 8
- 6
app/Http/Controllers/HomeController.php 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]);

Loading…
Cancel
Save