Create and delete an application view file through the ArtisanView extension package in Laravel 1. Introduction
This extension package adds two Artisan commands related to the view to the Laravel application, so that we can use the Artisan command to create and manage the view file, which is further a relief of productivity.
2. Installation
Or install it through Composer:
composer require sven/artisan-view
After the installation is complete, register the service provider ArtisanViewServiceProvider in config/app. php to the providers array:
// config/app.php'providers' => [ ... Sven\ArtisanView\ArtisanViewServiceProvider::class,];
3. use
If you run php artisan now, you will find two more commands to create and delete View files:
- make:view- scrap:view
Create View
# Create an 'index under the View root directory 'view. blade. php 'View file $ php artisan make: view index # create 'index' under the subdirectory 'Pages. blade. php 'View file $ php artisan make: view pages. index # Create a view file $ php artisan make: view index -- directory = custom/path # specify the view File extension $ php artisan make: view index -- extension = html # inherit an existing view $ php artisan make: view index -- extends = app # add the title and content section to the view $ php artisan make: view index -- sections = title, content # create a resource named products (including index, create, edit, and show view files) $ php artisan make: view products -- resource # create a specified action resource (index, create, and edit) $ php artisan make: view products -- resource -- verbs = index, create, edit # Create a resource file that inherits from layout and contains foo and bar $ php artisan make: view products -- resource -- extends = layout -- sections = foo, bar
Delete View
# Delete the view file 'index. blade. php' $ php artisan scrap: view index # delete a subdirectory view file through. $ php artisan scrap: view pages. index