dimanche 4 février 2018

Route [admin/update] not defined in Laravel

I am having trouble updating my data in Laravel and this is giving me headache. Every time i clicked on the update button error occurs.

Below is the error:

"Route [admin/update] not defined. (View: C:\xampp\htdocs\Tailor\core\resources\views\expensesCat\edit.blade.php)"

here is the edit.blade

<div class="portlet light bordered">
    <h3 class="page-title">Expenses Categories</h3>

   {!! Form::model($expenses_category, ['method' => 'POST', 'route' => ['admin/update', $expenses_category->id]]) !!}

    <div class="panel panel-default">
        <div class="panel-heading">
            Edit
        </div>

        <div class="panel-body">
            <div class="row">
                <div class="col-xs-12 form-group">
                <input name="order_create_by" type="hidden" value="">
                    {!! Form::label('name', 'Name*', ['class' => 'control-label']) !!}
                    {!! Form::text('name', old('name'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    <p class="help-block"></p>
                    @if($errors->has('name'))
                        <p class="help-block">
                            
                        </p>
                    @endif
                </div>
            </div>

        </div>
    </div>

The web.php

Route::post('/update/{id}', 'ExpensesCategoriesController@updateCat');

The ExpensesCategoriesController

 public function updateCat(UpdateExpensesCategoriesRequest $request, $id)
    {
        $expenses_category = ExpensesCategory::findOrFail($id);
        $expenses_category->update($request->all());

         return redirect('admin/expenses_categories');
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire