| @@ 6-43 (lines=38) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class CreateServicesTable extends Migration |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function up() |
|
| 14 | { |
|
| 15 | Schema::create('services', function (Blueprint $table) { |
|
| 16 | $table->increments('id'); |
|
| 17 | $table->integer('business_id')->unsigned(); |
|
| 18 | $table->foreign('business_id')->references('id')->on('businesses')->onDelete('cascade'); |
|
| 19 | $table->string('slug'); |
|
| 20 | $table->string('name'); |
|
| 21 | $table->integer('duration')->unsigned()->default(60); |
|
| 22 | $table->string('description'); |
|
| 23 | $table->string('prerequisites')->nullable(); |
|
| 24 | $table->string('color', 12)->nullable(); |
|
| 25 | $table->integer('type_id')->unsigned()->nullable()->after('id'); |
|
| 26 | $table->foreign('type_id')->references('id')->on('service_types')->onDelete('cascade'); |
|
| 27 | $table->softDeletes(); |
|
| 28 | $table->nullableTimestamps(); |
|
| 29 | ||
| 30 | $table->unique(['business_id', 'slug']); |
|
| 31 | }); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Reverse the migrations. |
|
| 36 | * |
|
| 37 | * @return void |
|
| 38 | */ |
|
| 39 | public function down() |
|
| 40 | { |
|
| 41 | Schema::drop('services'); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||
| @@ 6-44 (lines=39) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class CreateContactsTable extends Migration |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function up() |
|
| 14 | { |
|
| 15 | Schema::create('contacts', function (Blueprint $table) { |
|
| 16 | $table->increments('id'); |
|
| 17 | $table->integer('user_id')->unsigned()->nullable(); |
|
| 18 | $table->foreign('user_id')->references('id')->on('users'); |
|
| 19 | $table->string('nin')->nullable()->index(); |
|
| 20 | $table->enum('gender', ['M', 'F']); |
|
| 21 | $table->string('firstname'); |
|
| 22 | $table->string('lastname'); |
|
| 23 | $table->string('occupation')->nullable(); |
|
| 24 | $table->string('martial_status')->nullable(); |
|
| 25 | $table->string('postal_address')->nullable(); |
|
| 26 | $table->date('birthdate')->nullable(); |
|
| 27 | $table->char('mobile', 15)->nullable(); |
|
| 28 | $table->char('mobile_country', 2)->nullable(); |
|
| 29 | $table->string('email')->nullable(); |
|
| 30 | $table->nullableTimestamps(); |
|
| 31 | $table->softDeletes(); |
|
| 32 | }); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * Reverse the migrations. |
|
| 37 | * |
|
| 38 | * @return void |
|
| 39 | */ |
|
| 40 | public function down() |
|
| 41 | { |
|
| 42 | Schema::drop('contacts'); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||