diff --git a/app/Models/Student.php b/app/Models/Student.php new file mode 100644 index 0000000000000000000000000000000000000000..0a3986378dab2fc424f65c75d57dccd1f19a0c21 --- /dev/null +++ b/app/Models/Student.php @@ -0,0 +1,13 @@ +<?php + +namespace App\Models; + +use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Model; + +class Student extends Model +{ + use HasFactory; + + protected $fillable = ['firstname', 'lastname', 'email']; +} diff --git a/database/migrations/2023_10_20_064820_create_students_table.php b/database/migrations/2023_10_20_064820_create_students_table.php new file mode 100644 index 0000000000000000000000000000000000000000..28c913651e5447ebec88d4a3b9e7c29aa71f227a --- /dev/null +++ b/database/migrations/2023_10_20_064820_create_students_table.php @@ -0,0 +1,30 @@ +<?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(); + $table->string('firstname'); + $table->string('lastname'); + $table->string('email')->unique(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('students'); + } +};