-1

new to laravel and just wanted to get some tips on how to do the following.

So the view will show all created assignments (using for each i believe) that are stored in my database on PHPadmin. I want to be able to select one of these assignments and pass the assignment ID (name to the next view).,

Thanks

3
  • 2
    Try something, post what you tried and then we will help you. @each. Commented Oct 22, 2018 at 2:06
  • 1
    Yes you should show your efforts before asking. By going through the laravel official doc you should be able to come up with some code. Commented Oct 22, 2018 at 2:14
  • @Tim, check out this post Passing data to view in laravel Commented Oct 22, 2018 at 3:28

1 Answer 1

0

On your blade file:

@foreach ($users as $user)
    <tr onclick="window.location='{{route('user.edit', ['id' => $user->id])}}'">
    <td>{{$user->name}}</td>
    <td>{{$user->age}}</td>
    </tr>
@endforeach

On your route file:

Route::resource('/user', 'UserController', ['as' => 'user']);
Sign up to request clarification or add additional context in comments.

1 Comment

This answer may be helpful, but consider adding a brief explanation to help the original poster and future visitors understand how it works. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.