Selaa lähdekoodia

:construction: Corrige la mise à jour

master
Clement Desmidt 1 vuosi sitten
vanhempi
commit
92dc6f33f9
3 muutettua tiedostoa jossa 8 lisäystä ja 9 poistoa
  1. 1
    1
      app/Http/Controllers/HomeController.php
  2. 6
    5
      resources/views/update.blade.php
  3. 1
    3
      routes/web.php

+ 1
- 1
app/Http/Controllers/HomeController.php Näytä tiedosto

@@ -65,7 +65,7 @@ class HomeController extends Controller
->setBody($request->body)
->setCategory($request->category)
->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 view('update', ['deal' => $deal, 'type' => $type]);

+ 6
- 5
resources/views/update.blade.php Näytä tiedosto

@@ -14,19 +14,20 @@
</div>
@endif
<form method="post">
{{ csrf_field() }}
<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>
<textarea id="body" name="body">{{ $deal->getBody() }}</textarea>
<textarea id="body" name="body">{{ $deal->getBody() }}</textarea><br>
<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>
<select id="category" name="category">
<option value="">−</option>
@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
</select>
</select><br>
<input type="submit" value="Modifier" />
</form>
</div>

+ 1
- 3
routes/web.php Näytä tiedosto

@@ -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/update/{type}/{id}', 'HomeController@update')->name('deals.update');

Route::post('/deals/update/{type}/{id}', 'HomeController@update')->name('deals.update.post');
Route::match(['GET', 'POST'], '/deals/update/{type}/{id}', 'HomeController@update')->name('deals.update');

Loading…
Peruuta
Tallenna