芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/vendor/laravel/framework/src/Illuminate/Routing/RouteBinding.php
make($class), $method]; return $callable($value, $route); }; } /** * Create a Route model binding for a model. * * @param \Illuminate\Container\Container $container * @param string $class * @param \Closure|null $callback * @return \Closure * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException */ public static function forModel($container, $class, $callback = null) { return function ($value) use ($container, $class, $callback) { if (is_null($value)) { return; } // For model binders, we will attempt to retrieve the models using the first // method on the model instance. If we cannot retrieve the models we'll // throw a not found exception otherwise we will return the instance. $instance = $container->make($class); if ($model = $instance->resolveRouteBinding($value)) { return $model; } // If a callback was supplied to the method we will call that to determine // what we should do when the model is not found. This just gives these // developer a little greater flexibility to decide what will happen. if ($callback instanceof Closure) { return $callback($value); } throw (new ModelNotFoundException)->setModel($class); }; } }