I get data from database: $user = DB::table(‘view_users’)->where([ ‘id’ => $friend->user_id, ‘type’ => $friend->…
Tag: eloquent
Eloquent: Get ‘max’ values from a `hasMany` -> `hasOne` relationship
I have an interesting eloquent challenge and my knowledge is not quite there to work it through, hoping you smart folks can give me some guidance. I have read this: Getting just the latest value on a …
Laravel – Change default value eloquent
Is possible to modify the default value response from Laravel Eloquent? I have an API and my database has a migration payment. My payment has a column integer status. $table->integer(‘status’)-&…
Illegal operator and value combination when paginating in Laravel
I am a newbie at Laravel 6. In the view, I created a form, and when it’s submitted, it should return a table filtered with the links of pagination at the bottom. All works correctly, but when I click …
How to make a union query using Laravel Eloquent and Laravel Query Builder?
I am using laravel eloquent to CRUD data. My Problem is, I don’t know how to make UNION queries using laravel Eloquent ORM. Can you help me to solve my problem? This is my sample query that i want to …
Fetch encrypted data using where clause
My entire database is encrypted except the primary key(id). I need to fetch email using $email variable. $encrypted=registermodel::select(’email’)->where(’email’,’=’,$email)->get();
Running a for loop iteration on Laravel Eloquent
I have an model $club which is related to another model $events. I query the database for clubs using this $clubs = Club::get()->where(‘city’, $city); Then for the events, I am trying to copy …
Multiple image retrieval with laravel
I have uploaded multiple images to database already. Now i am trying to display them in my view. while using foreach to loop through images i am getting error – Invalid argument supplied for foreach() …
Multiple many to many polymorphic relationship problem in Laravel
So I have been working on a project where 2 types of users register. 1. Company 2. Distributor I have created modules for both and they both have separate authentication modules created using …
what’s the With() method in laravel?
I had refer some online references for understanding what to do with With method in laravel but still not understand. Laravel with(): What this method does? Here are some codes which I’m not understand, may I know what the a,b,c,d,e,f refer to? Answer Let me give you a direct example. If you’ve user table and that user table can be