organizrnginxsonarrradarrplexdashboardcouchpotatonzbgetbookmarkapplication-dashboardmuximuxlandingpagestartpagelandinghtpcserverhomepagesabnzbdheimdallemby
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
154 lines
3.4 KiB
154 lines
3.4 KiB
<?php
|
|
|
|
namespace Illuminate\Routing;
|
|
|
|
class PendingResourceRegistration
|
|
{
|
|
/**
|
|
* The resource registrar.
|
|
*
|
|
* @var \Illuminate\Routing\ResourceRegistrar
|
|
*/
|
|
protected $registrar;
|
|
|
|
/**
|
|
* The resource name.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $name;
|
|
|
|
/**
|
|
* The resource controller.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $controller;
|
|
|
|
/**
|
|
* The resource options.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $options = [];
|
|
|
|
/**
|
|
* Create a new pending resource registration instance.
|
|
*
|
|
* @param \Illuminate\Routing\ResourceRegistrar $registrar
|
|
* @param string $name
|
|
* @param string $controller
|
|
* @param array $options
|
|
* @return void
|
|
*/
|
|
public function __construct(ResourceRegistrar $registrar, $name, $controller, array $options)
|
|
{
|
|
$this->name = $name;
|
|
$this->options = $options;
|
|
$this->registrar = $registrar;
|
|
$this->controller = $controller;
|
|
}
|
|
|
|
/**
|
|
* Set the methods the controller should apply to.
|
|
*
|
|
* @param array|string|dynamic $methods
|
|
* @return \Illuminate\Routing\PendingResourceRegistration
|
|
*/
|
|
public function only($methods)
|
|
{
|
|
$this->options['only'] = is_array($methods) ? $methods : func_get_args();
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Set the methods the controller should exclude.
|
|
*
|
|
* @param array|string|dynamic $methods
|
|
* @return \Illuminate\Routing\PendingResourceRegistration
|
|
*/
|
|
public function except($methods)
|
|
{
|
|
$this->options['except'] = is_array($methods) ? $methods : func_get_args();
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Set the route names for controller actions.
|
|
*
|
|
* @param array|string $names
|
|
* @return \Illuminate\Routing\PendingResourceRegistration
|
|
*/
|
|
public function names($names)
|
|
{
|
|
$this->options['names'] = $names;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Set the route name for a controller action.
|
|
*
|
|
* @param string $method
|
|
* @param string $name
|
|
* @return \Illuminate\Routing\PendingResourceRegistration
|
|
*/
|
|
public function name($method, $name)
|
|
{
|
|
$this->options['names'][$method] = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Override the route parameter names.
|
|
*
|
|
* @param array|string $parameters
|
|
* @return \Illuminate\Routing\PendingResourceRegistration
|
|
*/
|
|
public function parameters($parameters)
|
|
{
|
|
$this->options['parameters'] = $parameters;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Override a route parameter's name.
|
|
*
|
|
* @param string $previous
|
|
* @param string $new
|
|
* @return \Illuminate\Routing\PendingResourceRegistration
|
|
*/
|
|
public function parameter($previous, $new)
|
|
{
|
|
$this->options['parameters'][$previous] = $new;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Set a middleware to the resource.
|
|
*
|
|
* @param mixed $middleware
|
|
* @return \Illuminate\Routing\PendingResourceRegistration
|
|
*/
|
|
public function middleware($middleware)
|
|
{
|
|
$this->options['middleware'] = $middleware;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Handle the object's destruction.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __destruct()
|
|
{
|
|
$this->registrar->register($this->name, $this->controller, $this->options);
|
|
}
|
|
}
|
|
|