Guest User

Untitled

a guest
Jul 11th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App;
  4.  
  5. use Illuminate\Database\Eloquent\Builder;
  6. use Illuminate\Database\Eloquent\Model;
  7. use Illuminate\Database\Eloquent\SoftDeletes;
  8.  
  9. class CompanyFinancial extends Model
  10. {
  11. use SoftDeletes;
  12.  
  13. protected $table = 'company_financial';
  14.  
  15. protected static function boot()
  16. {
  17. parent::boot();
  18.  
  19. // Order by name ASC
  20. static::addGlobalScope('order', function (Builder $builder) {
  21. $builder->orderBy('financial_year', 'asc');
  22. $builder->orderBy('financial_quarter', 'asc');
  23. });
  24. }
  25.  
  26. public function company()
  27. {
  28. return $this->belongsTo(Company::class);
  29. }
  30. }
Add Comment
Please, Sign In to add comment