diff --git a/app/Http/Controllers/GeneratorController.php b/app/Http/Controllers/GeneratorController.php index 3419733..eaf7692 100644 --- a/app/Http/Controllers/GeneratorController.php +++ b/app/Http/Controllers/GeneratorController.php @@ -24,23 +24,21 @@ class GeneratorController extends Controller { $input = Request::all(); $goal = Request::get('goal'); - $sets = 0; - $reps = ""; switch ($goal) { case "strength": - $sets = 8; + $sets = "5-8"; $reps = "1-6"; break; case "endurance": - $sets = 3; + $sets = "3"; $reps = "15-25"; break; case "definition": - $sets = 4; + $sets = "4"; $reps = "8-12"; break; default: - $sets = 3; + $sets = "3"; $reps = "10"; }; $preferences = [ @@ -55,16 +53,16 @@ class GeneratorController extends Controller foreach (array_keys($preferences, '') as $key) { unset($preferences[$key]); }; - $chest_exercises = []; - $back_exercises = []; - $legs_exercises = []; - $lower_legs_exercises = []; - $biceps_exercises = []; - $triceps_exercises = []; - $shoulders_exercises = []; - $forearms_exercises = []; - $abs_exercises = []; - #$_exercises = []; + $chestExercises = []; + $backExercises = []; + $legsExercises = []; + $lowerLegsExercises = []; + $bicepsExercises = []; + $tricepsExercises = []; + $shouldersExercises = []; + $forearmsExercises = []; + $absExercises = []; + #$Exercises = []; function getExercises($muscle, $preference) { $exercises = DB::table('exercises') ->where('exercise_type', $preference) @@ -73,48 +71,89 @@ class GeneratorController extends Controller return $exercises; }; foreach ($preferences as $preference) { - $chest_exercises = array_merge($chest_exercises, getExercises('chest', $preference)); - $back_exercises = array_merge($back_exercises, getExercises('back', $preference)); - $legs_exercises = array_merge($legs_exercises, getExercises('legs', $preference)); - $lower_legs_exercises = array_merge($lower_legs_exercises, getExercises('lower_legs', $preference)); - $biceps_exercises = array_merge($biceps_exercises, getExercises('biceps', $preference)); - $triceps_exercises = array_merge($triceps_exercises, getExercises('triceps', $preference)); - $shoulders_exercises = array_merge($shoulders_exercises, getExercises('shoulders', $preference)); - $forearms_exercises = array_merge($forearms_exercises, getExercises('forearms', $preference)); - $abs_exercises = array_merge($abs_exercises, getExercises('abs', $preference)); + $chestExercises = array_merge($chestExercises, getExercises('chest', $preference)); + $backExercises = array_merge($backExercises, getExercises('back', $preference)); + $legsExercises = array_merge($legsExercises, getExercises('legs', $preference)); + $lowerLegsExercises = array_merge($lowerLegsExercises, getExercises('lowerLegs', $preference)); + $bicepsExercises = array_merge($bicepsExercises, getExercises('biceps', $preference)); + $tricepsExercises = array_merge($tricepsExercises, getExercises('triceps', $preference)); + $shouldersExercises = array_merge($shouldersExercises, getExercises('shoulders', $preference)); + $forearmsExercises = array_merge($forearmsExercises, getExercises('forearms', $preference)); + $absExercises = array_merge($absExercises, getExercises('abs', $preference)); }; }; + $cardio = DB::table('exercises') + ->where('exercise_type', 'cardio') + ->lists('exercise_name'); $years = intval(Request::get('years')); $months = intval(Request::get('months')); + $frequency = intval(Request::get('frequency')); $total = ($years * 12) + $months; - $experience = 0; switch ($total) { case ($total >= 24): - $experience = 3; + $experience = "Advanced"; break; case ($total > 6): - $experience = 2; + $experience = "Intermediate"; break; default: - $experience = 1; + $experience = "Beginner"; + $largeMuscleExercises = 1; + $smallMuscleExercises = 1; + $headers = ["Full Body Day"]; + }; + function fullBodyDay () { + + }; + function upperBodyDay () { + + }; + function lowerBodyDay () { + + }; + function chestDay ($frequency, $largeMuscleExercises, $smallMuscleExercises) { + + }; + function backDay () { + + }; + function legDay () { + + }; + function armDay () { + + }; + function createWorkout () { + + } + $listsOfExercises = [ + $chestExercises, + $backExercises, + $legsExercises, + $lowerLegsExercises, + $bicepsExercises, + $tricepsExercises, + $shouldersExercises, + $forearmsExercises, + $absExercises, + $cardio + ]; + for ($i = 0; $i < count($listsOfExercises); $i++) { + shuffle($listsOfExercises[$i]); + }; + for ($i = 0; $i < 3; $i++) { + $listsOfExercises[$i] = array_slice($listsOfExercises[$i], 0, $largeMuscleExercises); + }; + for ($i = 3; $i < count($listsOfExercises); $i++) { + $listsOfExercises[$i] = array_slice($listsOfExercises[$i], 0, $smallMuscleExercises); }; - $frequency = intval(Request::get('frequency')); - $large_muscle = 3; - $small_muscle = 2; return view('generator/workout', [ - 'goal' => $goal, + 'goal' => ucfirst($goal), 'preferences' => implode(', ', $preferences), 'experience' => $experience, 'frequency' => $frequency, - 'chest_exercises' => array_slice($chest_exercises, 0, $large_muscle), - 'back_exercises' => array_slice($back_exercises, 0, $large_muscle), - 'legs_exercises' => array_slice($legs_exercises, 0, $large_muscle), - 'lower_legs_exercises' => array_slice($lower_legs_exercises, 0, $small_muscle), - 'biceps_exercises' => array_slice($biceps_exercises, 0, $small_muscle), - 'triceps_exercises' => array_slice($triceps_exercises, 0, $small_muscle), - 'shoulders_exercises' => array_slice($shoulders_exercises, 0, $small_muscle), - 'forearms_exercises' => array_slice($forearms_exercises, 0, $small_muscle), - 'abs_exercises' => array_slice($abs_exercises, 0, $small_muscle) + 'listsOfExercises' => $listsOfExercises, + 'headers' => $headers ]); } } \ No newline at end of file diff --git a/exercises.dump b/exercises.dump new file mode 100644 index 0000000..e69de29 diff --git a/public/assets/css/styles.css b/public/assets/css/styles.css index afcba2a..2306183 100644 --- a/public/assets/css/styles.css +++ b/public/assets/css/styles.css @@ -200,7 +200,7 @@ body { .workout { width:75%; border:1px solid black; - margin:auto; + margin:10px auto; text-align:center; } diff --git a/resources/views/generate.blade.php b/resources/views/generate.blade.php deleted file mode 100644 index 1ea35a3..0000000 --- a/resources/views/generate.blade.php +++ /dev/null @@ -1,102 +0,0 @@ -@extends('layouts.master') - -@section('title', 'Generate') - -@section('content') -