🚧 Corrige la mise à jour
This commit is contained in:
parent
eda18e25e8
commit
92dc6f33f9
@ -65,7 +65,7 @@ class HomeController extends Controller
|
|||||||
->setBody($request->body)
|
->setBody($request->body)
|
||||||
->setCategory($request->category)
|
->setCategory($request->category)
|
||||||
->setPrice($request->price)
|
->setPrice($request->price)
|
||||||
->save($folder_path);
|
->save(sprintf('%s/%s', config('app.deals_dir'), $type), false);
|
||||||
return redirect()->route('deals.list', ['type' => $type])->with('status', ($result ? 'Deal mis à jour': 'ERREUR'));
|
return redirect()->route('deals.list', ['type' => $type])->with('status', ($result ? 'Deal mis à jour': 'ERREUR'));
|
||||||
}
|
}
|
||||||
return view('update', ['deal' => $deal, 'type' => $type]);
|
return view('update', ['deal' => $deal, 'type' => $type]);
|
||||||
|
@ -14,19 +14,20 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
{{ csrf_field() }}
|
||||||
<label for="subject">Sujet : </label>
|
<label for="subject">Sujet : </label>
|
||||||
<input type="text" id="subject" name="subject" value="{{ $deal->getSubject() }}" />
|
<input type="text" id="subject" name="subject" value="{{ $deal->getSubject() }}" /><br>
|
||||||
<label for="body">Description : </label>
|
<label for="body">Description : </label>
|
||||||
<textarea id="body" name="body">{{ $deal->getBody() }}</textarea>
|
<textarea id="body" name="body">{{ $deal->getBody() }}</textarea><br>
|
||||||
<label for="price">Prix : </label>
|
<label for="price">Prix : </label>
|
||||||
<input type="text" id="price" name="price" value="{{ $deal->getPrice() }}" />
|
<input type="text" id="price" name="price" value="{{ $deal->getPrice() }}" /><br>
|
||||||
<label for="category">Catégorie : </label>
|
<label for="category">Catégorie : </label>
|
||||||
<select id="category" name="category">
|
<select id="category" name="category">
|
||||||
<option value="">−</option>
|
<option value="">−</option>
|
||||||
@foreach(\Shikiryu\LBCReposter\Categories::$categories as $id => $category)
|
@foreach(\Shikiryu\LBCReposter\Categories::$categories as $id => $category)
|
||||||
<<option value="{{ $id }}"{{ $deal->getCategory() === $id ? ' selected="selected"': '' }}>{{ $category }}</option>
|
<<option value="{{ $id }}" @if( $deal->getCategory() === $category ) selected="selected" @endif>{{ $category }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select><br>
|
||||||
<input type="submit" value="Modifier" />
|
<input type="submit" value="Modifier" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,6 +23,4 @@ Route::get('/deals/view/{type}/{id}', 'HomeController@view')->name('deals.view')
|
|||||||
|
|
||||||
Route::get('/deals/delete/{type}/{id}', 'HomeController@delete')->name('deals.delete');
|
Route::get('/deals/delete/{type}/{id}', 'HomeController@delete')->name('deals.delete');
|
||||||
|
|
||||||
Route::get('/deals/update/{type}/{id}', 'HomeController@update')->name('deals.update');
|
Route::match(['GET', 'POST'], '/deals/update/{type}/{id}', 'HomeController@update')->name('deals.update');
|
||||||
|
|
||||||
Route::post('/deals/update/{type}/{id}', 'HomeController@update')->name('deals.update.post');
|
|
||||||
|
Loading…
Reference in New Issue
Block a user