diff --git a/Entities/Customer.php b/Entities/Customer.php new file mode 100644 index 0000000..1a16936 --- /dev/null +++ b/Entities/Customer.php @@ -0,0 +1,18 @@ + + */ + +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); + } +} diff --git a/Entities/CustomersGroup.php b/Entities/CustomersGroup.php new file mode 100644 index 0000000..75b70f4 --- /dev/null +++ b/Entities/CustomersGroup.php @@ -0,0 +1,25 @@ + + */ + +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); + } +} diff --git a/Entities/Mailbox.php b/Entities/Mailbox.php new file mode 100644 index 0000000..72a13e9 --- /dev/null +++ b/Entities/Mailbox.php @@ -0,0 +1,18 @@ + + */ + +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); + } +}