Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Model;
  4.  
  5. use Illuminate\Database\Eloquent\Model;
  6. use Illuminate\Database\Eloquent\SoftDeletes;
  7.  
  8. class Outlet extends Model
  9. {
  10.     use SoftDeletes;
  11.     protected $table = 'outlets';
  12.     protected $connection = 'mysql';
  13.     protected $primaryKey = 'id';
  14.  
  15.     public $timestamps = true;
  16.     public $incrementing = true;
  17.  
  18.     public function companies()
  19.     {
  20.         return $this->belongsToMany(Company::class, 'company_outlet', 'outlet_id', 'company_id')
  21.         ->withPivot([
  22.             'outlet_code','client_code'
  23.         ])
  24.         ->withTimestamps();
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement