Page 28 - Laravel5_v1
P. 28
์
้
3. เมื อเราสรางไฟล์ migration ไฟล์ทั งหมดสามารถตรวจสอบไดที โฟลเดอร database\migrations
้
้
้
้
้
Note: ตัวเลขดานหนาคือวันที และเวลาที สรางขณะนั น ไม่มีผลกระทบต่อโคดอะไร ซึ งแต่ละคนจะไม่เหมือนกัน
้
้
ื
ิ
้
4. เปดไฟล์ xxx_create_typebooks_table.php เพื อเขียนโคดในการสรางโครงสรางของตาราง โดยโคดสราง table ที เมธอด ชอว่า
้
้
up() และเขียนเพื อลบ table ใน เมธอด ชอว่า down() ดังนี
ื
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTypebooksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('typebooks', function (Blueprint $table) {
$table->increments('id'); //รหัสประเภทหนังสือ
ี
$table->string('name'); //รายละเอยดประเภทหนังสือ