@author: Charly Capillanes => IPP [System Team]
@description: This services help developers to auto create view blade file base on blade syntax structure. here
@more
@example:
@code
@output:
the blade files is auto create by “Auto View [Services]”
@description: This services help developers to auto create view blade file base on blade syntax structure. here
@more
(1) Create a custom controller and call / use
"App\Services\AutoViewService" by constructs.
public function __construct(AutoViewService $view)
{
$this->view = $view;
}
(2) Create a custom function .
public function page(): string | \Illuminate\Contracts\View\View
{
}
(3) Create a
@route: Route::get('/', [PageController::class, 'page']);
(4) Call function [handle]
->blade() to set blade file structure "page.index". and set a render / param output ->render, ->param
(5) This function is supported by
Illuminate\Support\Facades\File to create a directory and files automatically.
(6) You can set your own custom template by
->blade('page.index', 'custom.page.index')
(7)
@output: will be auto create directory and file blade. check our resources directory. @example page/index.blade.php @example:
$this->view->blade('page.index')->render();
$this->view->blade('page.single')->param(['id' => $id]);
@code
// render
public function page(): string | \Illuminate\Contracts\View\View
{
return $this->view->blade('page.index')->render();
}
// param
public function single(int $id = 1): \Illuminate\Contracts\View\View
{
return $this->view->blade('page.single')->param(['id' => $id]);
}
@output:
view/page/index.blade.php
view/page/single/index.blade.php
the blade files is auto create by “Auto View [Services]”