Answers for "laravel pass data to name route model binding"

PHP
1

how to pass parameter in routes of laravel

##Defining Route:##
Route::get('edit-industry/{id}', ['as' => 'admin.editIndustry', 'uses' => 'Industries@edit']);

##Calling Route:##
{{ route('admin.editIndustry',[$id]) }}
Posted by: Guest on October-17-2021
0

laravel model bind with route in model

/**
 * Retrieve the model for a bound value.
 *
 * @param  mixed  $value
 * @param  string|null  $field
 * @return \Illuminate\Database\Eloquent\Model|null
 */
public function resolveRouteBinding($value, $field = null)
{
    return $this->where('name', $value)->firstOrFail();
}
Posted by: Guest on July-29-2020

Code answers related to "laravel pass data to name route model binding"

Browse Popular Code Answers by Language