1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class Leave extends Model
- {
- protected $table = 'leaves';
- protected $guarded = [];
- public function student()
- {
- return $this->belongsTo('App\Models\Student');
- }
- public function course()
- {
- return $this->belongsTo('App\Models\Course');
- }
- public function studentCourse()
- {
- return $this->belongsTo('App\Models\StudentCourse');
- }
- public function getStudentName()
- {
- return empty($this['student']) ? '' : $this['student']->name;
- }
- public function getCourseName()
- {
- return empty($this['course']) ? '' : $this['course']->name;
- }
- }
|