Create and delete an application view file using the ArtisanView extension package in Laravel

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.