| Code Coverage | ||||||||||
| Classes and Traits | Functions and Methods | Lines | ||||||||
| Total |  | 0.00% | 0 / 1 |  | 0.00% | 0 / 5 | CRAP |  | 0.00% | 0 / 6 | 
| Company |  | 0.00% | 0 / 1 |  | 0.00% | 0 / 5 | 30 |  | 0.00% | 0 / 6 | 
| operations |  | 0.00% | 0 / 1 | 2 |  | 0.00% | 0 / 1 | |||
| banks |  | 0.00% | 0 / 1 | 2 |  | 0.00% | 0 / 1 | |||
| accountLines |  | 0.00% | 0 / 1 | 2 |  | 0.00% | 0 / 1 | |||
| users |  | 0.00% | 0 / 1 | 2 |  | 0.00% | 0 / 2 | |||
| serializeDate |  | 0.00% | 0 / 1 | 2 |  | 0.00% | 0 / 1 | |||
| 1 | <?php | 
| 2 | |
| 3 | namespace Qmp\Laravel\Compta\Models; | 
| 4 | |
| 5 | use Illuminate\Database\Eloquent\Model; | 
| 6 | |
| 7 | class Company extends Model | 
| 8 | { | 
| 9 | protected $connection = 'comptability'; | 
| 10 | |
| 11 | protected $table = 'companies'; | 
| 12 | |
| 13 | /** | 
| 14 | * Get the comments for the blog post. | 
| 15 | */ | 
| 16 | public function operations() | 
| 17 | { | 
| 18 | return $this->hasMany('Qmp\Laravel\Compta\Models\Operation'); | 
| 19 | } | 
| 20 | |
| 21 | /** | 
| 22 | * Get the comments for the blog post. | 
| 23 | */ | 
| 24 | public function banks() | 
| 25 | { | 
| 26 | return $this->hasMany('Qmp\Laravel\Compta\Models\Bank'); | 
| 27 | } | 
| 28 | |
| 29 | /** | 
| 30 | * Get the comments for the blog post. | 
| 31 | */ | 
| 32 | public function accountLines() | 
| 33 | { | 
| 34 | return $this->hasMany('Qmp\Laravel\Compta\Models\AccountLine'); | 
| 35 | } | 
| 36 | |
| 37 | /** | 
| 38 | * The roles that belong to the user. | 
| 39 | */ | 
| 40 | public function users() | 
| 41 | { | 
| 42 | $database = $this->getConnection()->getDatabaseName(); | 
| 43 | return $this->belongsToMany('App\User', "$database.company_user"); | 
| 44 | } | 
| 45 | |
| 46 | /** | 
| 47 | * Prepare a date for array / JSON serialization. | 
| 48 | * | 
| 49 | * @param \DateTimeInterface $date | 
| 50 | * @return string | 
| 51 | */ | 
| 52 | protected function serializeDate(\DateTimeInterface $date) | 
| 53 | { | 
| 54 | return $date->format('Y-m-d H:i:s'); | 
| 55 | } | 
| 56 | |
| 57 | } |