Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Too few arguments to function App\Http\Controllers\Home\ClientLogoController::EditClientImage() Controller Laravel

I am using Laravel 9 and I am getting this error I tried various methods to fix this issue but I’m stuck on this . Please help me.

Here is my code:

@php($i=1)
@foreach($client_image as $item)
    <tr>
        <td>{{ $i++ }}</td>
        <td>
            <img style="width:60px;height:50px;" src="{{ asset($item->client_logo_images) }}"/>
        </td>
        <td>
            <a href="{{ route('edit.client.logoimage',$item->id) }}">
                <i class="glyphicon glyphicon-edit"></i>
            </a> 
            <a class="btn btn-danger sm" href="">
                <i class="glyphicon glyphicon-trash"></i>
            </a>
        </td>
    </tr>
@endforeach

I have passed Id with the route and capture. Here is the code. :-

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Route::get('/edit/client/image/{id}','EditClientImage')->name('edit.client.logoimage');

And this is my controller code .

public function EditClientImage($id) {
    $client_logo=ClientLogoImage::findOrFail($id);
    return view('admin.home.edit_client',compact('client_logo'));
}

and an error is showing in line 51. This is my line 51. public function EditClientImage($id)
and I am redirecting it to edit_client Here is the code for edit_client 

<form method="post" action="{{ route('update.client.image') }}" enctype="multipart/form-data">   
    @csrf
    <input name="id" type="hidden" value="{{ $client_logo->id }}"  >
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">Edit Profile</h3>
        </div>
        <div class="card-body">
            <div class="row">
            <div class="form-group">
                <label for="formFile" class="form-label mt-0">Profile Image Upload</label>
                <input name="client_image" id="image" class="form-control" type="file" >
            </div>
        </div>
        <button class="btn btn-primary" type="submit">Update</button>
    </div>
    
</form>

Thank You

>Solution :

<a href="{{ route('edit.client.logoimage', ['id' => $item->id]) }}">

You need to name it as id…

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading