I wish I could more eloquently explain what I am trying to accomplish here but I am still quite new to Laravel so please forgive if I misuse any terminology in my explanation.
I am trying to apply a foreach loop to my form that I built using the Laravel Collective HTML Form Builder (...correct?) and apply the values I pull from the database to the value fields of the form.
The output it is giving me is what is literally typed in my code. I know its because of the single quotation marks but if I remove them I get a syntax error for not including them.
Here is my code below as it will probably explain what I am trying to do better than how I am describing it.
The controller create function:
public function create()
{
//
$exercise_types = ExerciseType::all();
return view('workouts.create', ['exercise_types' => $exercise_types]);
}
Foreach loop in HTML Form Builder form
I wish I could more eloquently explain what I am trying to accomplish here but I am still quite new to Laravel so please forgive if I misuse any terminology in my explanation.
I am trying to apply a foreach loop to my form that I built using the Laravel Collective HTML Form Builder (...correct?) and apply the values I pull from the database to the value fields of the form.
The output it is giving me is what is literally typed in my code. I know its because of the single quotation marks but if I remove them I get a syntax error for not including them.
Here is my code below as it will probably explain what I am trying to do better than how I am describing it.
The controller create function:
The create view:
@extends('layouts.app')
@section('content')
Create New Workout
{!! Form::open(['url' => 'workouts']) !!}
{!! Form::close() !!}
@endsection
The form view itself:
@foreach($exercise_types as $exercise_type)
{!! Form::label('exercise_type', '{{ $exercise_type->exercise_type }}:') !!}@endforeach
{!! Form::submit($submitButtonText, ['class' => 'btn btn-primary form-control']) !!}Any guidance would be appreciated.