Refer to URL via resource()

This commit is contained in:
Nabeel Shahzad 2018-01-01 16:26:02 -06:00
parent 6b0d7d8ea4
commit dd400806ee
2 changed files with 26 additions and 21 deletions

View File

@ -37,7 +37,7 @@ Route::group([
# pirep related routes
Route::resource('pireps', 'PirepController');
Route::match(['get'], 'pireps/pending', 'PirepController@pending');
Route::match(['post', 'put'], 'pireps/{id}/status', 'PirepController@status');
Route::match(['post', 'put'], 'pireps/{id}/status', 'PirepController@status')->name('pirep.status');
Route::resource('pirepfields', 'PirepFieldController');

View File

@ -10,13 +10,16 @@
</a>
</h5>
<div>
@if($pirep->state == PirepState::PENDING)
<div class="badge badge-warning">Pending</div>
@if($pirep->state === PirepState::PENDING)
<div class="badge badge-warning">
@elseif($pirep->state === PirepState::ACCEPTED)
<div class="badge badge-success">Accepted</div>
<div class="badge badge-success">
@elseif($pirep->state === PirepState::REJECTED)
<div class="badge badge-danger">
@else
<div class="badge badge-danger">Rejected</div>
<div class="badge badge-info">
@endif
{!! PirepState::label($pirep->state) !!}</div>
</div>
</div>
<div class="col-sm-10">
@ -57,7 +60,8 @@
<td>
@if($pirep->state == PirepState::PENDING
|| $pirep->state == PirepState::REJECTED)
{!! Form::open(['url' => url('/admin/pireps/'.$pirep->id.'/status'), 'method' => 'post',
{!! Form::open(['url' => route('admin.pirep.status', ['id'=>$pirep->id]),
'method' => 'post',
'name' => 'accept_'.$pirep->id,
'id' => $pirep->id.'_accept',
'pirep_id' => $pirep->id,
@ -71,7 +75,8 @@
<td>
@if($pirep->state == PirepState::PENDING
|| $pirep->state == PirepState::ACCEPTED)
{!! Form::open(['url' => url('/admin/pireps/'.$pirep->id.'/status'), 'method' => 'post',
{!! Form::open(['url' => route('admin.pirep.status', ['id'=>$pirep->id]),
'method' => 'post',
'name' => 'reject_'.$pirep->id,
'id' => $pirep->id.'_reject',
'pirep_id' => $pirep->id,