Skip to content
Advertisement

Too few arguments to function AppHttpControllersHomeClientLogoController::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. :-

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

Advertisement

Answer

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

You need to name it as id…

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement