parent
2c39469592
commit
69cd679b97
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class DoublerRequest extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function student(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Student::class);
|
||||
}
|
||||
|
||||
public function event(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\DoublerService;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
|
@ -49,4 +50,9 @@ class Student extends Model
|
|||
|
||||
return $this->first_name.' '.$this->last_name;
|
||||
}
|
||||
|
||||
public function doublerRequests(): HasMany
|
||||
{
|
||||
return $this->hasMany(DoublerService::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\Student;
|
||||
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('doubler_request', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Event::class)->constrained()->cascadeOnDelete()->cascadeOnUpdate();
|
||||
$table->foreignIdFor(Student::class)->constrained()->cascadeOnDelete()->cascadeOnUpdate();
|
||||
$table->string('request');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('doubler_request');
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue