Problem retrieving values from imported array

Posted 1 year ago by JokersMild85

I'm receiving an error when I try to output some values from an array. The error I'm receiving is "Trying to get property of non-object". Can someone take a look at my code and see what I'm doing wrong?

Controller method:

public function step(Request $request)
    $values = $request->input('exercise');
        $array = explode("-", $values[$i]);
        $exercises[$i]['exercise_id'] = $array[0];
        $exercises[$i]['exercise_type_id'] = $array[1];
        $exercises[$i]['exercise_name'] = $array[2];

    return view('workouts.step', compact('exercises'));

Code from the view:

@foreach($exercises as $exercise)

{!! Form::label('exercise_name', $exercise->exercise_name) !!}


Right now I'm just trying to get output from one of the array keys , exercise_name.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.