problem with query where select

Published 4 days ago by daniel21gt

I have tried to do a where query with a select options

Code with error

"Trying to get property of non-object (View: C:\laragon\www\crudgobernaciontres\resources\views\Usuario\index.blade.php)"

In this module I consult all the records, but I also want to select by username, I still do not get it.

view controller

Is it possible to do this in the same module?


This seems to be invalid

<form action="{{route('', $id->$usuario_ad)}}" method="POST">

Note the $id->$usuario_ad. I think you need one of the parameters here instead of both!

4 days ago (1,037,395 XP)

Not sure what you are trying to do but your loop will not produce valid html


I just want to filter a list with a where, so

select * from users where userad = danielad;

In my view I select an option

then this selection sent it to my controller

I just want to see the table with the data referring to "danielad"

1 day ago (1,179,925 XP)

Your form fields always need to be inside the <form> and </form> tags. Otherwise your browser doesn't understand how to post it. After that you should be able to get it from the request.

Note that you can't post to a get route. In this case the show route is already a get route and you can't combine the two. Instead you can use a query parameter in your url to do the filter

<form method="GET" action="{{ route('', $id) }}">

    // Your select here
    // Your submit button here


// In your controller you can access the filter like so
public function show(Request $request, $id)
    $filter = $request->get('tipo');

    // your query with above filter

    // The response here

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