首页 > 后端开发 > php教程 > 使用laravel 的artisan快速创建表

使用laravel 的artisan快速创建表

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
发布: 2016-06-23 13:31:00
原创
1363 人浏览过

创建migrate 文件


php artisan make:migration create_comments_table
登录后复制
编辑表字段


<?phpuse Illuminate\Database\Schema\Blueprint;use Illuminate\Database\Migrations\Migration;class CreateCommentTable extends Migration {	/**	 * Run the migrations.	 *	 * @return void	 */	public function up()	{        Schema::create('comment',function(Blueprint $table){            $table->engine = 'InnoDB';            $table->increments('id');            $table->integer('news_id');            $table->string('author_name');            $table->string('author_url');            $table->string('author_key');            $table->string('ip');            $table->string('message');            $table->string('mail');            $table->integer('create_time');            $table->integer('parent_id');        });	}	/**	 * Reverse the migrations.	 *	 * @return void	 */	public function down()	{		//	}}
登录后复制
创建表

php artisan migrate
登录后复制





本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板