分类 编程 下的文章

【说明:本笔记参照laravel学院帖子进行整理】

1.laravel基本的路由种类很多,常用的有any、get、post。

get

Route::get('/hello',function(){
    return "Hello Laravel[GET]!";
});

post

Route::get('/testPost',function(){
    $csrf_token = csrf_token();
    $form = <<<FORM
        <form action="/hello" method="POST">
            <input type="hidden" name="_token" value="{$csrf_token}">
            <input type="submit" value="Test"/>
        </form>
FORM;
    return $form;
});

Route::post('/hello',function(){
    return "Hello Laravel[POST]!";
});

- 阅读剩余部分 -

1.在脚本里添加

$table->string('mobile', 13);

最终:

        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('mobile', 13);
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->rememberToken();
            $table->timestamps();
        });

这样添加的手机号字段mobile属性为“vachar(13)”

- 阅读剩余部分 -