命令
其他
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21# 生成静态页面控制器
php artisan make:controller StaticPagesController
# 命名路由
Route::get('/', 'StaticPagesController@home')->name('home');
# 创建数据库
php artisan make:migration create_statuses_table --create="statuses"
# 数据库迁移
php artisan migrate
# 数据回滚
php artisan migrate:rollback
# 创建Model同时创建迁移文件
php artisan make:model Models/Article -m
# 创建授权策略
php artisan make:policy UserPolicy
# 生出数据填充文件
php artisan make:seeder UsersTableSeeder
# 填充数据
php artisan db:seed
php artisan db:seed --class=UsersTableSeeder
# 重置+填充
php artisan migrate:refresh --seedArtisan命令
1
2
3
4
5
6
7
8
9
10
11
12
13php artisan key:generate # 生成 App Key
php artisan make:controller # 生成控制器
php artisan make:model # 生成模型
php artisan make:policy # 生成授权策略
php artisan make:seeder # 生成 Seeder 文件
php artisan migrate # 执行迁移
php artisan migrate:rollback # 回滚迁移
php artisan migrate:refresh # 重置数据库
php artisan db:seed # 填充数据库
php artisan tinker # 进入 tinker 环境
php artisan route:list # 查看路由列表
# 查看帮助
php artisan help migrate
模板
css
1
2
3
4
5# 初始化样式
yarn install --no-bin-links
yarn add cross-env
npm run dev
npm run watch-pollhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14<!-- 引入public目录下的样式文件 -->
{{ mix('css/app.css') }}
<!-- 继承父视图 -->
@extends('layouts.default')
<!-- 填充父视图content块 -->
@section('content')
<h1>主页</h1>
@stop
<!-- 引入局部视图 -->
@include('layouts._header')
<!-- 连接 -->
{{ route('help') }}
<!-- 显示旧输入数据 -->
{{ old('name') }}
路由
1 | Route::resource('users', 'UsersController'); |
数据
1 | # 一对多 |