当前位置: 首页 > 软件库 > Web应用开发 > Web框架 >

artisan-view

授权协议 MIT License
开发语言 PHP
所属分类 Web应用开发、 Web框架
软件类型 开源软件
地区 不详
投 递 者 戚奇略
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

artisan-view

Artisan View

This package adds a handful of view-related commands to Artisan in your Laravelproject. Generate blade files that extend other views, scaffold out sectionsto add to those templates, and more. All from the command line we know and love!

Index

Installation

You'll have to follow a couple of simple steps to install this package.

Downloading

Via composer:

$ composer require sven/artisan-view --dev

Registering the service provider

If you're using Laravel 5.5 or above, you can skip this step. The service provider will have already beenregistered thanks to auto-discovery.

Otherwise, register Sven\ArtisanView\ServiceProvider::class manually in your AppServiceProvider'sregister method:

public function register()
{
    if ($this->app->environment() !== 'production') {
        $this->app->register(\Sven\ArtisanView\ServiceProvider::class);
    }    
}

Usage

If you now run php artisan you will see two new commands in the list:

  • make:view
  • scrap:view

Creating views

# Create a view 'index.blade.php' in the default directory
$ php artisan make:view index

# Create a view 'index.blade.php' in a subdirectory ('pages')
$ php artisan make:view pages.index

# Create a view with a different file extension ('index.html')
$ php artisan make:view index --extension=html

Extending and sections

# Extend an existing view
$ php artisan make:view index --extends=app

# Add a section to the view
$ php artisan make:view index --section=content

# Add multiple sections to the view
$ php artisan make:view index --section=title --section=content

# Add an inline section to the view
# Remember to add quotes around the section if you want to use spaces
$ php artisan make:view index --section="title:Hello world"

# Create sections for each @yield statement in the extended view
$ php artisan make:view index --extends=app --with-yields

# Add @push directives for each @stack statement in the extended view
$ php artisan make:view index --extends=app --with-stacks

REST resources

# Create a resource called 'products'
$ php artisan make:view products --resource

# Create a resource with only specific verbs
$ php artisan make:view products --resource --verb=index --verb=create --verb=edit

Scrapping views

# Remove the view 'index.blade.php'
$ php artisan scrap:view index

# Remove the view by dot notation
$ php artisan scrap:view pages.index

This will ask you if you're sure. To skip this question, pass the --force flag:

# Don't ask for confirmation
$ php artisan scrap:view index --force

Scrapping a REST resource

# Remove the resource called 'products'
$ php artisan scrap:view products --resource

This will remove the views products.index, products.show, products.create, and products.edit. If the directoryproducts/ is empty after doing that, it will also be deleted.

You can scrap part of a resource by adding --verb flags:

# Remove the 'products.create' and 'products.edit' views.
$ php artisan scrap:view products --resource --verb=create --verb=edit

Mix and match

Of course, all the options work well together like you'd expect. So the following command...

$ php artisan make:view products --resource --extends=app --section="title:This is my title" --section=content

... will put the following contents in products/index.blade.php, products/edit.blade.php, products/create.blade.php,and products/show.blade.php:

@extends('app')

@section('title', 'This is my title')

@section('content')

@endsection

Contributing

All contributions (in the form on pull requests, issues and feature-requests) arewelcome. See the contributors page for all contributors.

License

sven/artisan-view is licenced under the MIT License (MIT). Please see thelicense file for more information.

  • 1、简介 本扩展包添加了两个视图相关的Artisan命令到Laravel应用,以便我们通过Artisan命令即可创建和管理视图文件,可谓是进一步解放了生产力。 2、安装 还是通过Composer安装: composer require sven/artisan-view 安装完成后到config/app.php中注册服务提供者ArtisanViewServiceProvider到providers

  • λ php artisan Laravel Framework 5.4.27 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application v

  • 1、简介  本扩展包添加了两个视图相关的Artisan命令到Laravel应用,以便我们通过Artisan命令即可创建和管理视图文件,可谓是进一步解放了生产力。 2、安装  还是通过Composer安装: composer require sven/artisan-view 1 安装完成后到config/app.php中注册服务提供者ArtisanViewServiceProvider到provi

  • 1、简介 本扩展包添加了两个视图相关的Artisan命令到Laravel应用,以便我们通过Artisan命令即可创建和管理视图文件,可谓是进一步解放了生产力。 2、安装 还是通过Composer安装: 1 composer require sven /artisan-view 安装完成后到config/app.php中注册服务提供者ArtisanViewServiceProvider到provid

  • // 针对命令显示帮助信息 php artisan --help OR -h // 抑制输出信息 php artisan --quiet OR -q // 打印 Laravel 的版本信息 php artisan --version OR -V // 不询问任何交互性的问题 php artisan --no-interaction OR -n // 强制输出 ANSI 格式 php artisan

  • php artisan 命令  说明  备注 php artisan make:resource ? 创建api返回格式化资源    >=5.4版本可用 php artisan make:rule ? 创建validate规则    >=5.4版本可用 php artisan make:exception ?    创建异常类   >=5.4版本可用 php artisan make:factor

  • 当我运行命令php artisan migrate时,将导致以下错误 [Illuminate\Database\QueryException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table users (id int unsigned

  • php  artisan 命令列表 Options: //选项 -h, --help //显示此帮助消息 -q, --quiet //不输出任何消息 -V, --version //显示此应用程序版本 --ansi //强制ANSI输出 --no-ans

  • 1、简介 本扩展包添加了两个视图相关的Artisan命令到Laravel应用,以便我们通过Artisan命令即可创建和管理视图文件,可谓是进一步解放了生产力。 2、安装 还是通过Composer安装: 1 composer require sven /artisan-view 安装完成后到config/app.php中注册服务提供者ArtisanViewServiceProvider到provid

  • 介绍 根据模型自动生成页面表单,提高网站开发速度。 houdunren.com @ 向军大叔 安装组件 安装组件 composer require houdunwang/laravel-view 生成配置文件 php artisan vendor:publish --provider="Houdunwang\Structure\ServiceProvider" 组件会生成配置文件 config/h

  • 添加了两个视图相关的Artisan命令到Laravel应用,以便我们通过Artisan命令即可创建和管理视图文件。 通过Composer安装: composer require sven/artisan-view   安装完成后到config/app.php中注册服务提供者ServiceProvider到providers数组: // config/app.php 'providers' => [

 相关资料
  • // 在版本 5.1.11 新添加,见 http://d.laravel-china.org/docs/5.1/authorization#creating-policies php artisan make:policy PostPolicy // 针对命令显示帮助信息 php artisan --help OR -h // 抑制输出信息 php artisan --quiet OR -q //

  • 简介 Artisan 是 Laravel 自带的命令行接口,它提供了许多实用的命令来帮助你构建 Laravel 应用。要查看所有可用的 Artisan 命令的列表,可以使用 list 命令: php artisan list 每个命令包含了「帮助」界面,它会显示并概述命令的可用参数及选项。只需要在命令前面加上 help 即可查看命令帮助界面: php artisan help migrate

  • 所有的自定义命令,都 必须 有项目的命名空间。 如: php artisan phphub:clear-token php artisan phphub:send-status-email ... 错误的例子为: php artisan clear-token php artisan send-status-email ...

  • TestBird 崩溃分析(Artisan) Android SDK 使用指南 最新版本1.0.4 更新内容Testbird Artisan Android SDK 支持H5插件,可收集H5 JS异常; 修复启动次数统计bug 一、快速集成 TestBird 崩溃分析(Artisan) Android SDK,支持Android 2.3 及以上版本。 集成具体方法如下: Step 1. 创建App

  • 这是我第一次使用laravel生成PHP程序,起初我创建了一个由作曲家写的博客,在这个博客中,我可以运行php artisan。但是,我从互联网上下载了一个laravel项目,我不能运行artisan,并给我错误的结果如下。[照明\数据库\查询例外] SQLSTATE[HY000][2002]没有这样的文件或目录(SQL:选择计数(*)作为 聚合从其中=Ldap和=1)[原则\DBAL\Drive

  • 目前Artisan只是实现了一些常用的功能,比如创建数据库,创建数据表,创建服务,控制器,模型等。 除此之外,还可以执行终端任务,这个功能非常强大,任务程序中你除了拿不到 Web 相关的数据(ip, url, session等),其他框架资源你都可以随意调用。 你可以意味着你可以使用编写任何复杂的终端 controller, 将控制器在终端运行 (后面有演示 demo)。 在app根目录下执行 p