Add Entities definitions
This commit is contained in:
parent
42da48ce2b
commit
1c456d4aca
3 changed files with 61 additions and 0 deletions
18
Entities/Customer.php
Normal file
18
Entities/Customer.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
/*
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
|
||||
*/
|
||||
|
||||
namespace Modules\MMFCustomersGroups\Entities;
|
||||
|
||||
use App\Customer as BaseCustomer;
|
||||
|
||||
class Customer extends BaseCustomer {
|
||||
/**
|
||||
* Get the groups this Customer belongs to.
|
||||
*/
|
||||
public function groups() {
|
||||
return $this->belongsToMany(CustomersGroup::class);
|
||||
}
|
||||
}
|
25
Entities/CustomersGroup.php
Normal file
25
Entities/CustomersGroup.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/*
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
|
||||
*/
|
||||
|
||||
namespace Modules\MMFCustomersGroups\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CustomersGroup extends Model {
|
||||
/**
|
||||
* Get the Mailbox this group is linked to.
|
||||
*/
|
||||
public function mailbox() {
|
||||
return $this->belongsTo(Mailbox::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Customers that are included in this group.
|
||||
*/
|
||||
public function customers() {
|
||||
return $this->belongsToMany(Customer::class);
|
||||
}
|
||||
}
|
18
Entities/Mailbox.php
Normal file
18
Entities/Mailbox.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
/*
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
|
||||
*/
|
||||
|
||||
namespace Modules\MMFCustomersGroups\Entities;
|
||||
|
||||
use App\Mailbox as BaseMailbox;
|
||||
|
||||
class Mailbox extends BaseMailbox {
|
||||
/**
|
||||
* Get the customers groups linked to this Mailbox.
|
||||
*/
|
||||
public function groups() {
|
||||
return $this->hasMany(CustomersGroup::class);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue