original_string: 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 call_user_func($callback, $value);
              }
  
              throw (new ModelNotFoundException)->setModel($class);
          };
      }
code: 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 call_user_func($callback, $value);
              }
  
              throw (new ModelNotFoundException)->setModel($class);
          };
      }
code_tokens: 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 call_user_func ( $ callback , $ value ) ; } throw ( new ModelNotFoundException ) -> setModel ( $ class ) ; } ; }
docstring: Create a Route model binding for a model.
  
  @param  \Illuminate\Container\Container  $container
  @param  string  $class
  @param  \Closure|null  $callback
  @return \Closure
docstring_tokens: Create a Route model binding for a model .