

Laravel Craftsman CLI
source link: https://www.tuicool.com/articles/hit/Bfm6ZnA
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Laravel Craftsman is a CLI for easily crafting Laravel assets for any project (artisan make on steroids) by Mike Erickson . This project relies onLaravel Zero, providing a suite of “project agnostic” CLI tools that you install globally:
composer global require codedungeon/laravel-craftsman
You can create all assets for a typical model/view/controller setup using the craft:all
command:
laravel-craftsman craft:all Post \ --model App/Models/Post \ --tablename posts \ --rows 50 \ --extends layouts.app \ --section content
Take note that this command also takes care of extending the layouts/app.blade.php
file in template files.
Here’s an example from the readme you can use to generate a migration file complete with the table definition using the --fields
option:
--fields fname:string@25:nullable,lname:string@50:nullable,email:string@80:nullable:unique,dob:datetime,notes:text,deleted_at:timezone # results in... Schema::create('contacts', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); $table->string('fname', 25)->nullable(); $table->string('lname', 50)->nullable(); $table->string('email', 80)->nullable()->unique(); $table->datetime('dob'); $table->text('notes'); $table->timezone('deleted_at'); });
The project also allows you to configure the templates used for the generated files with the Mustache templating language. Here’s an example of the class
template at the time of writing:
<?php namespace {{namespace}}; class {{model}} { {{#constructor}} function __construct() {} {{/constructor}} }
Check out the readme
for the full list of commands and flags. You can also run laravel-craftsman list
from the command line after you’ve installed the package globally and added it to your path. You can learn more about this package and check out the source code on GitHub at mikeerickson/laravel-craftsman
.
Recommend
-
32
README.md Laravel Craftsman Description Laravel Craftsman (written using the awesome Laravel-Zero C...
-
76
readme.md Laravel Vapor CLI Laravel Vapor is an auto-scaling, serverless deployment platform for Laravel, power...
-
6
Craftsman, Craftswoman, Craftsperson 02 May 2018 In the past I have used the term “Craftswoman” only when refering directly to a woman. In most other cases, including most gender neutral cases, I have used the ter...
-
6
The Laborer and the Craftsman 30 January 2013 In a recent blog Ted Neward made this remarkable statement: ...
-
8
Death of a Craftsman Posted: April 5, 2020 | Author: Einar | Filed under: Uncategorized
-
8
The PHP craftsman does not suddenly work advertisements I have started to learn Laravel. Until now, everything worked perfectly. I'm following this...
-
9
数据结构与算法(十三)——红黑树1 红黑树是一种自平衡的排序二叉树,常用于关联数组、字典,在各种语言的底层实现中被广泛应用,Java 的 T...
-
3
Clean Architecture: A Craftsman's Guide to Software Structure and Design George Aristy on Dec 28, 20212021-12-28T00:00:00-05:00 Jan 12022-01-01T14:55:48-05:00 11 min
-
6
How do you attain the mindset of a great coder? Reading these five books will give you a great start.Software Craftmanship Requires Reading the Right Books
-
8
A poor craftsman blames his tools Yesterday, Alfred Thompson posted on students know...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK