lundi 15 octobre 2018

How to redirect different edit pages acording to table column values in laravel?

in my laravel 5.6 app I have some edit pages to regarding different vehicle types. I need redirect them by cheching vehicles table categoryname values, my vehicle table as following,

id  name   model    year  categoryname  user_id
1   toyota  121     2001      car           1
2   nissan  sunney  1998      car           2
3   toyota  liteace 2000      van           5
4   isuzu   elf     2005      truck         9
5   bmw     520d    2010      car           7

this is edit and delete buttons links blade file,

<td><a class="button is-outlined" href="" >Edit</a></td>

                            <td><a class="button is-outlined" href="/myads//delete" onclick="return confirm('Are you sure to want to delete this record?')" >Delete</a></td>

and route,

Route::get('myads/{id}/edit', [
    'uses' => '\App\Http\Controllers\VehicleController@edit',
    'as'=> 'vehicles.edit'
]);

now I have different edit blade file as caredit, vanedit, truckedit etc... in vechicles view file. there fore I need check vehicle table categoryname values and redirect them with suitable edit view file. How can do this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire