DB::commit not apply

when sending a message to the chat, the PHP script is launched. It creates an "application", and starts executing a chain of actions. In...
10

Need help for query parent model constraints

I have 3 Models which is Chain, Customer & Chain-Invoice class Chain extends Model { public function invoices() {...
07

How to create a MySQL view to show all paths for each node in a nested set model through a related table?

I have two tables, categories and products. Categories table is a nested set model. Products table has a serial_number...
00

Mass updating the order of models with Eloquent

I have a model named 'Post', which has a field (integer) called 'order'. I have built the frontend to arrange the posts by order with Vue draggable...
07

What is your preferred re-factor method?

When using solely Eloquent (so technically no need for repositories) what is your preferred method of choice when it comes to refactoring and perfo...
03

Many to many attach() throwing exception

I have a many to many relationship set up: public function aircraft () { return $this->belongsToMany(Aircraft::class...
01

Relationship between 3 Entities

I have 3 Entities "User", "Article" and "Comment" how should I set them in a relationship? I thought about User->h...
05

looping through cached users for who's online list

i'm trying to implement who's online feature in my app, its is basically a list of logged in users, after. After researching this, i found o...
03

Eloquent Relationship Pivot Table with 3 Model

Hi comunity... i'm a little confused, i need to implements a user role according to an trade unions that the user belongs. The user can belongs to...
00

Factory each closure with Belongs to Relation

Hi there, I am using a factory for creating employees. Each employee has one insurance and bank; moreover, each belongs to an address (yes,...
03

One to One relation problem

Hi, I have defined following relationship on a 'survey' model: public function tenant () { return $this->hasOne(Person...
09

laravel eloquent timstamps / parsing timestamps

For an existing application, storing the last login date of a user as a integer based timestamp, I would need to develop a custom laravel based mod...
03

Route model binding not returning any results

I have a route, which points to a method on a controller. On the model, I've set getRouteKeyName as the slug, but when I call the method in a test,...
00

ErrorException in HasRelationships, Class not found

In the posting function of my app, posts exist in a three-stage hierarchy comprising Genre, Category, and Post. Genres have many categories, catego...
09

How to return list of (grouped by) items?

I want it to return a list of permissions grouped by type like group 1 => [......]; group 2 => [......]; group 3=> [.......
02

error on the boot method

i have this trait which returning this error Undefined variable: event // on the boot method <?php n...
04

Use union in a query

Hi there, I'm trying to create a query with union this are my query: $code = DB::table('articles') ->leftjoin('aliquoteiva', 'vat_id', '=', 'se...
02

Eloquent isn't returning the fields where a column result is expected to be 0

I'm doing a query in eloquent that returns all months on a year, and said months have a sum related to a table, I've got everything running smoothl...
05

SQL Query Relationship

Below is my query. The main query (on "books") returns 100+ records which all belong to "user" requested. The internal query (o...
03

What is Default Ordering for Get()?

Hi, If you don't use orderBy(), what is the default field that Eloquent orders results by when using get()? -=Chris...
02