2024-05-07 12:17:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Illuminate\Routing;
|
|
|
|
|
|
2024-08-13 13:44:16 +00:00
|
|
|
use Illuminate\Contracts\Routing\ResponseFactory;
|
2024-05-07 12:17:25 +02:00
|
|
|
|
|
|
|
|
class ViewController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
2024-08-13 13:44:16 +00:00
|
|
|
* The response factory implementation.
|
2024-05-07 12:17:25 +02:00
|
|
|
*
|
2024-08-13 13:44:16 +00:00
|
|
|
* @var \Illuminate\Contracts\Routing\ResponseFactory
|
2024-05-07 12:17:25 +02:00
|
|
|
*/
|
2024-08-13 13:44:16 +00:00
|
|
|
protected $response;
|
2024-05-07 12:17:25 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new controller instance.
|
|
|
|
|
*
|
2024-08-13 13:44:16 +00:00
|
|
|
* @param \Illuminate\Contracts\Routing\ResponseFactory $response
|
2024-05-07 12:17:25 +02:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2024-08-13 13:44:16 +00:00
|
|
|
public function __construct(ResponseFactory $response)
|
2024-05-07 12:17:25 +02:00
|
|
|
{
|
2024-08-13 13:44:16 +00:00
|
|
|
$this->response = $response;
|
2024-05-07 12:17:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Invoke the controller method.
|
|
|
|
|
*
|
|
|
|
|
* @param array $args
|
2024-08-13 13:44:16 +00:00
|
|
|
* @return \Illuminate\Http\Response
|
2024-05-07 12:17:25 +02:00
|
|
|
*/
|
|
|
|
|
public function __invoke(...$args)
|
|
|
|
|
{
|
2024-08-13 13:44:16 +00:00
|
|
|
[$view, $data, $status, $headers] = array_slice($args, -4);
|
2024-05-07 12:17:25 +02:00
|
|
|
|
2024-08-13 13:44:16 +00:00
|
|
|
return $this->response->view($view, $data, $status, $headers);
|
2024-05-07 12:17:25 +02:00
|
|
|
}
|
|
|
|
|
}
|