Home > Backend Development > PHP Tutorial > 使用laravel 的artisan快速创建表

使用laravel 的artisan快速创建表

WBOY
Release: 2016-06-23 13:31:00
Original
1323 people have browsed it

创建migrate 文件


php artisan make:migration create_comments_table
Copy after login
编辑表字段


<?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()	{		//	}}
Copy after login
创建表

php artisan migrate
Copy after login





source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template