for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace A17\Twill\Http\Controllers\Admin;
use Illuminate\Routing\ResponseFactory;
use Illuminate\View\Factory as ViewFactory;
class TemplatesController extends Controller
{
/**
* @var ViewFactory
*/
protected $viewFactory;
* @var ResponseFactory
protected $responseFactory;
public function __construct(ViewFactory $viewFactory, ResponseFactory $responseFactory)
parent::__construct();
$this->viewFactory = $viewFactory;
$this->responseFactory = $responseFactory;
}
* @return \Illuminate\View\View
public function index()
return $this->viewFactory->make('templates.index');
* @param string $view
public function view($view)
return $this->viewFactory->make('templates.' . $view);
* @param string view
A17\Twill\Http\Controllers\Admin\view
view
\
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
public function xhr($view)
$response = [
'data' => $this->viewFactory->make('templates.' . $view)->render(),
'has_more' => (rand(0, 10) > 5),
];
return $this->responseFactory->json($response);