Getting error while clicking on edit function button in laravel

Arvindh

I need to edit by data from database via my admin panel. So i created table with clickable button for edit function. Picture of Admin panel with Edit button

Now when I click on edit button, I am seeing ID number at bottom but getting sorry page couldn't found error ! I have double checked all controller, route and everything. It seems all good, but I don't know what's the error!

Route Code:

 Route::get('/admin/baseFare',[
 'uses' => 'ExtraBaseFareController@basefare',
 'as' => 'base.fare'
 ]);

 Route::get('/admin/baseFare/edit/{$id}',[
 'uses' => 'ExtraBaseFareController@editBaseFare',
 'as' => 'editbase.fare'
 ]);

 Route::post('/admin/baseFare/update/{id}', [
 'uses' => 'ExtraBaseFareController@baseFareUpdate',
 'as' => 'base.fareupdate'
 ]);`

Controller Code:

public function basefare()
{
    $base = BaseFare::all();
    return view('Admin.BaseFare.index')->With('base', $base);

}

public function editBaseFare($id)
{
    $base = BaseFare::find($id);

    return view('Admin.BaseFare.editBaseFare')->with('base', $base);

}

public function baseFareUpdate(Request $request, $id) 
{

    $base = BaseFare::find($id);

    $base->fareinpercentage = $request->fareinpercentage;

    $base->fareinrupees = $request->fareinrupees;

    $base->save();

    Session::flash('success','Base fare successfully updated');

    return redirect()->route('base.fare');

}

Index Page code:

 <table class="table display nowrap table-striped table-bordered bootstrap-3 scroll-horizontal">
                                    <thead>
                                    <tr>
                                        <th>S.No</th>
                                        <th>Fare in Percentage (%)</th>
                                        <th>Fare in Rupees (Rs)</th>
                                        <th>Actions</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @php $number = 1; @endphp
                                    @foreach($base as $base)
                                        <tr>
                                            <td>
                                                {{ $number.'.' }}
                                                @php $number++; @endphp
                                            </td>
                                            <td>{{ $base->fareinpercentage }}</td>
                                            <td>{{ $base->fareinrupees }}</td>
                                            <td> 
                                            <a href="{{ route('editbase.fare',['id' => $base->basefareid ]) }}" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill" title="Edit ">
                                                <i class="la la-edit"></i>
                                                </a>
                                            </td>
                                        </tr>
                                    @endforeach
                                    </tbody>
                                </table>`

Edit Page Code:

 <form class="form" method="post" action="{{ route('base.fareupdate',['id' => $base->basefareid ]) }}">
                                    <div class="form-body">
                                        <h4 class="form-section"><i class="la la-eye"></i>Base Fare Controller</h4>
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label for="userinput2">Fare in Percentage (%)</label>
                                                    <input type="text" id="fareinpercentage"  value="{{ $base->fareinpercentage }}" class="form-control border-primary" name="fareinpercentage">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group">
                                                    <label for="userinput3">Fare in Rupee (Rs)</label>
                                                    <input type="text" id="fareinrupees" value="{{ $base->fareinrupees }}" class="form-control border-primary" name="fareinrupees">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-actions right">
                                        <button type="button" class="btn btn-warning mr-1">
                                            <i class="ft-x"></i> Cancel
                                        </button>
                                        <button type="submit" name="submit" class="btn btn-primary">
                                            <i class="la la-check-square-o"></i> Save
                                        </button>
                                    </div>
                                </form>`

These are the codes, the kindly help me to find our the error, The main function is to edit the field from database!

b0r1s

If I understand the question correctly you can't go to the edit page. Run 'php artisan route:list' and compare the routes. And I can't figure out why you have dollar sign before the id in the route.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Function is not getting called on clicking the button

Getting error after clicking 'calculate' button

want to get value of productCode while clicking on edit button

Error while clicking next button with Selenium Python

error while clicking the send button 'post_detail' is not a valid view function or pattern name

Append new text field while clicking a button and remove by clicking button in Laravel 4

Getting error while clicking on custom GUI navigation item in ONOS 2.4.0

how to change row color as selected while clicking on edit icon button with jquery /javascript

magento 1.9 getting javascript error while customer edit

Getting error while migrating laravel 7 to 8

Getting error while connecting sybase laravel

Getting error while trying to load laravel project

php mysql edit function error submit button show error

Not getting notification on clicking the button why?

getting error of suspend function while using coroutine

Getting error while using the random choices function

Getting NaN error while using parseInt function

Getting No file error while calling a function in python

Getting an Error while using AverageIFS Function

Move mainwindow while clicking on button

changing img while clicking button

while clicking on button validation is not working

clicking on the dynamically created edit button is not working

Edit button jquery function

Clicking button element in function, JavaScript

How to call function by not clicking the button?

While running laravel phpunit testcase , i'm getting an error "Call to a member function connection() on null" in Model.php line 1249

While clicking on forget password directly from landing page getting error Url not found

Getting 'E/AndroidRuntime: Error reporting crash android.os.TransactionTooLargeException' on clicking a Positive button of AlertDialog