mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 10:49:10 -04:00
46 lines
805 B
PHP
46 lines
805 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Course extends Model
|
|
{
|
|
public function bookings()
|
|
{
|
|
return $this->morphMany('App\Booking', 'bookable');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo('App\User');
|
|
}
|
|
|
|
public function instructor()
|
|
{
|
|
if (\App\User::find($this->user_id))
|
|
{
|
|
return \App\User::find($this->user_id)->fullname();
|
|
}
|
|
else
|
|
{
|
|
return $this->user_id;
|
|
}
|
|
}
|
|
|
|
public function event()
|
|
{
|
|
return $this->belongsTo('App\Event');
|
|
}
|
|
|
|
public function logs()
|
|
{
|
|
return $this->morphMany('App\Log', 'logable');
|
|
}
|
|
|
|
public function use_course()
|
|
{
|
|
return $this->name == "" && $this->ocom == "";
|
|
}
|
|
}
|