Add files for event and auditions. First draft of migrations

This commit is contained in:
Matt Young 2024-05-30 19:56:30 -05:00
parent 5d46ffbf73
commit acb2d64179
10 changed files with 281 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class AuditionController extends Controller
{
//
}

View File

@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class EventController extends Controller
{
//
}

11
app/Models/Audition.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Audition extends Model
{
use HasFactory;
}

11
app/Models/Event.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Event extends Model
{
use HasFactory;
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\Audition;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class AuditionPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Audition $audition): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Audition $audition): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Audition $audition): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Audition $audition): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Audition $audition): bool
{
//
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\Event;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class EventPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Event $event): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Event $event): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Event $event): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Event $event): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Event $event): bool
{
//
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Audition>
*/
class AuditionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Event>
*/
class EventFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?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('events', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('events');
}
};

View File

@ -0,0 +1,33 @@
<?php
use App\Models\Event;
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('auditions', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(Event::class)->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->string('name');
$table->integer('order')->nullable()->unique();
$table->date(('entry_deadline'));
$table->integer('entry_fee');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('auditions');
}
};