Create and Delete app view files in Laravel with Artisan view expansion pack

Source: Internet
Author: User

1. Introduction

This expansion pack adds two view-related artisan commands to the Laravel app, so that we can create and manage view files with the artisan command to further liberate productivity.

2. Installation

or through composer installation:

Composer require Sven/artisan-view

After the installation is complete, register the service provider Artisanviewserviceprovider to the providers array in config/app.php:

config/app.php ' providers ' = [    ...    Sven\artisanview\artisanviewserviceprovider::class,];

3. Use

If you run PHP now artisan will find the following two commands, respectively, to create and delete the view file:

-Make:view-scrap:view

Create a View

# create ' index.blade.php ' view files under View root ' views ' file $ php artisan make:view index# create ' index.blade.php ' view files under Subdirectories ' pages ' PHP artisan Make:view pages.index# Create a view file in a custom directory (relative to the system root) $ PHP Artisan Make:view Index--directory=custom/path# Specify view file name extension $ php Artisan Make:view Index--extension=html# inherits an existing view $ PHP Artisan Make:view index--extends=app# add title and Content section $ p in the view HP Artisan Make:view Index--sections=title,content# Create a resource named products (including index, create, edit, show view) $ 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, bar $ php artisan Make:view products--resource--extends=layout--sections=foo,bar

Delete a view

# delete view file ' index.blade.php ' $ php artisan scrap:view index# through. Delete subdirectory view files $ php artisan Scrap:view Pages.index
  • Related Article

    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.