I've a Laravel Application but being more straight forward!
How to use where query, i want to get all the data of table where email is current auth()->user()->email
.
I've used a submitter column where i post the email of who is posting the data. Currently i'm trying like this:
@foreach (\App\Models\InsertFormModel::all()->where('submitter', value: strtolower(auth()->user()->email)) as $formData)
CodePudding user response:
I think it's enough like this
$email = strtolower( auth()->user()->email );
$get_data = \App\Models\InsertFormModel::where('submitter',$email)->get();
CodePudding user response:
If I understand correct it seems you are trying to using where
clause on Collection
(which also has a method called where but for filter data on its items) because all()
method will fetch all records in your table in database and put into a Collection object. You could try this
@foreach (\App\Models\InsertFormModel::where(('submitter', strtolower(auth()->user()->email))->get() as $formData)