Creating a layout
A layout is made of two files — a PHP configuration file and the component template assigned to it. Both are created with anartisan command.
The command asks which kind of component you want, Vue or Blade.
With Vue, the component
MyCustomLayout.vue is created in resources/views/admin/components/layouts. With Blade, the file MyCustomLayout.blade.php is created in resources/views/admin.Configuring the layout
The first file is the PHP class holding the settings of the component.app/Admin/Layouts/MyExampleLayout.php
Position
The$position property decides where the generated component is placed.
Supplying the component
A Vue component can also be created on its own, without the PHP configuration file, with
php artisan admin:component MyTestLayout. Answer layout when asked for the component type.Registering the layout
Assign the PHP configuration file to the admin model through the$layouts property.
app/Article.php
app/Article.php
In this case, create the standalone Vue component with
php artisan admin:component MyTestLayout and answer layout when asked for the component type.The Vue component
Through theprops attribute the component receives the record being edited, the newly created record and other information you can work with.
resources/views/admin/components/layouts/MyCustomLayout.vue