Skip to content

Commit

Permalink
chore: generate Teacher and Student model use `artisan make:model Mod…
Browse files Browse the repository at this point in the history
…el -msf` command
  • Loading branch information
godruoyi committed Jan 8, 2024
1 parent bb434c9 commit ae21f00
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Models/Student.php
@@ -0,0 +1,11 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Student extends Model
{
use HasFactory;
}
11 changes: 11 additions & 0 deletions app/Models/Teacher.php
@@ -0,0 +1,11 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Teacher extends Model
{
use HasFactory;
}
23 changes: 23 additions & 0 deletions database/factories/StudentFactory.php
@@ -0,0 +1,23 @@
<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Student>
*/
class StudentFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
23 changes: 23 additions & 0 deletions database/factories/TeacherFactory.php
@@ -0,0 +1,23 @@
<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Teacher>
*/
class TeacherFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
27 changes: 27 additions & 0 deletions database/migrations/2024_01_08_071752_create_students_table.php
@@ -0,0 +1,27 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('students', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('students');
}
};
27 changes: 27 additions & 0 deletions database/migrations/2024_01_08_071804_create_teachers_table.php
@@ -0,0 +1,27 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('teachers', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('teachers');
}
};
17 changes: 17 additions & 0 deletions database/seeders/StudentSeeder.php
@@ -0,0 +1,17 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class StudentSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
17 changes: 17 additions & 0 deletions database/seeders/TeacherSeeder.php
@@ -0,0 +1,17 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class TeacherSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

0 comments on commit ae21f00

Please sign in to comment.