Create instruments model in preparation for audition etudes.

This commit is contained in:
Matt Young 2025-12-16 15:09:04 -06:00
parent b5ca5ab177
commit d04996b87b
3 changed files with 85 additions and 0 deletions

10
app/Models/Instrument.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Instrument extends Model
{
//
}

View File

@ -0,0 +1,32 @@
<?php
use Database\Seeders\InstrumentSeeder;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('instruments', function (Blueprint $table) {
$table->id();
$table->string('instrument');
$table->integer('score_order');
$table->index('score_order');
});
Artisan::call('db:seed', ['--class' => InstrumentSeeder::class]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('instruments');
}
};

View File

@ -0,0 +1,43 @@
<?php
/** @noinspection PhpUnused */
namespace Database\Seeders;
use App\Models\Instrument;
use Illuminate\Database\Seeder;
class InstrumentSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$defaultInstruments = [
['instrument' => 'Piccolo', 'score_order' => 10],
['instrument' => 'Flute', 'score_order' => 20],
['instrument' => 'Oboe', 'score_order' => 30],
['instrument' => 'Bassoon', 'score_order' => 40],
['instrument' => 'Eb Clarinet', 'score_order' => 50],
['instrument' => 'Bb Clarinet', 'score_order' => 60],
['instrument' => 'Bb Bass Clarinet', 'score_order' => 70],
['instrument' => 'Eb Contrabass Clarinet', 'score_order' => 80],
['instrument' => 'Bb Contrabass Clarinet', 'score_order' => 90],
['instrument' => 'Eb Alto Saxophone', 'score_order' => 100],
['instrument' => 'Bb Tenor Saxophone', 'score_order' => 110],
['instrument' => 'Eb Baritone Saxophone', 'score_order' => 120],
['instrument' => 'Bb Trumpet', 'score_order' => 130],
['instrument' => 'French Horn', 'score_order' => 140],
['instrument' => 'Trombone', 'score_order' => 150],
['instrument' => 'Euphonium BC', 'score_order' => 160],
['instrument' => 'Euphonium TC', 'score_order' => 170],
['instrument' => 'Tuba', 'score_order' => 180],
['instrument' => 'Percussion', 'score_order' => 200],
['instrument' => 'String Bass', 'score_order' => 300],
];
Instrument::insert($defaultInstruments);
//
}
}