Нема описа

Permission.php 510B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Permission extends Model
  5. {
  6. public $timestamps = false;
  7. protected $fillable = [
  8. 'user_id',
  9. 'level',
  10. 'division_id'
  11. ];
  12. public function division() {
  13. if ($this->level === 1) {
  14. return $this->belongsTo(Department::class, 'division_id');
  15. } else if ($this->level === 2) {
  16. return $this->belongsTo(Faculty::class, 'division_id');
  17. }
  18. return null;
  19. }
  20. }