Q:

Laravel 5.5 Controller@destroy DI won't inject model

I have resource controller with following destroy method:
public function destroy(ClinicImage $clinicImage)
{
    $clinicImage->delete();

    return redirect()->back()->with('success', 'Изображение удалено');
}

Also I have grid with following lines:
<td>
    <div class="btn-group btn-group">
        <button type="button" data-url="{{route('admin.clinic-image.destroy', [$clinic->id, $image->id])}}" class="btn btn-danger">
            <i class="fa fa-remove fa-fw"></i>
        </button>
    </div>
</td>

And finally I have function to send form on button click:
$('.table').find('.btn.btn-danger').click(function(){
     var form = makeForm({_method: 'DELETE'},{action: $(this).data('url')});
     form.submit();
});

function makeForm(data, options) {
    var form = document.createElement('form');
    form.method = 'POST';

    var token = document.createElement('input');

    token.name = '_token';
    token.value = jQuery('meta[name="csrf-token"]').attr('content');

    form.appendChild(token);

    jQuery.each(data, function(key, value){
        var input = document.createElement('input');

        input.name = key;
        input.value = value;

        form.appendChild(input);
    });

    if(Object.keys(options).length) {
        jQuery.each(options, function(option, value){
            form[option] = value;
        });
    }

    document.body.appendChild(form);

    return form;
}

When i sending form to /admin/clinic/1/clinic-image/1, I get following error:
Type error: Argument 1 passed to App\Http\Controllers\Admin\ClinicImageController::destroy() must be an instance of App\ClinicImage, string given
Controller routes. 

So my question is: Why DI do not recognize my route and model id? 

A:

Try this one:
public function destroy($clinic, $clinicImage)
{
    $clinicImage = ClinicImage::where('id', $clinic)->where('image', $clinicImage); //I'm guessing the name of the columns. 
    $clinicImage->delete();

    return redirect()->back()->with('success', 'Изображение удалено');
}

