Creating a structure with Jobs, Events, Listeners, Queues in Laravel 8

510 views Asked by At

I have a flow about that. I can solve the problem on paper. As a system admin, we have the following models: Clients, Departments, Users, Visitors, Calls, and Meetings.

  • Clients are our customers.
  • Departments are customers' departments.
  • Users have many roles, but we inspect the "Agent" role to define the agent as a call center worker.
  • Visitors are those who want to meet with an active agent by selecting a client and department.
  • Calls are a log table. If visitors can find the agent and send data to the agent, I store data in the call table.
  • Meetings If the agent accepts the call, I store it in the meeting table and notify the agent and visitor.

Client.php (Model)

public function users(){
   return $this->hasMany(User::class);
}
public function departments(){
   return $this->hasMany(Department::class);
}

Department.php (Model)

public function department_users(){
    return $this->belongsToMany(User::class, 'department_user');
}
public function client(){
    return $this->belongsToMany(Client::class, 'client_id');
}

User.php (Model)

public function departments(){
  return $this->belongsToMany(Department::class, 'department_user');
}

Visitor.php (Model)

public function department(){
  return $this->belongsTo(Department::class);
}

So as you can see, we define the relationships, and we want to do something like that:

Here is the flow...

1

The question is, how can I do that in Laravel 8?

0

There are 0 answers