Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel model bind with route in model

/**
 * Retrieve the model for a bound value.
 *
 * @param  mixed  $value
 * @param  string|null  $field
 * @return IlluminateDatabaseEloquentModel|null
 */
public function resolveRouteBinding($value, $field = null)
{
    return $this->where('name', $value)->firstOrFail();
}
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #model #bind #route #model
ADD COMMENT
Topic
Name
4+3 =