Created exercises

- Added endpoint to retrieve the list of exercises
This commit is contained in:
2020-04-26 20:33:09 +01:00
parent cfa0c0ab81
commit 8dbdb24ad6
6 changed files with 123 additions and 3 deletions

View File

@@ -15,10 +15,10 @@ class CreateUsersTable extends Migration
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('username')->unique()->nullable(false);
$table->string('email')->unique()->nullable(false);
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('password')->nullable(false);
$table->rememberToken();
$table->timestamps();
});

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExercisesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exercises', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable(false)->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exercises');
}
}

View File

@@ -0,0 +1,27 @@
<?php
use App\Exercise;
use Illuminate\Database\Seeder;
class ExerciseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$exercises = [
'BENT OVER HIGH ROWS', 'LOW PULL APARTS', 'BENT OVER LOW ROWS', 'ARCHER PULLS',
'PUSH-UP w/ BAND', 'REVERSE GRIP FLYE', 'WRAPAROUND MOST MUSCULAR', 'WRAPAROUND PRESS', 'REVERSE CRUNCHES',
'STANDING BICEPS CURLS', 'SINGLE-ARM CONCENTRATION CURLS', 'SINGLE-ARM OVERHEAD EXTENSIONS', 'SINGLE-ARM KICKBACKS',
'STANDING SINGLE-ARM PRESS', 'SINGLE-ARM LATERAL RAISE', 'HIGH PULL APARTS', 'FRONT RAISES',
'OVERHEAD SQUAT', 'SINGLE LEG SQUAT', 'STIFF LEG DEADLIFT', 'SINGLE LEG CALF RAISE'
];
foreach ($exercises as $exercise) {
Exercise::create(['name' => $exercise]);
}
}
}