12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
-
- use Illuminate\Auth\UserTrait;
- use Illuminate\Auth\UserInterface;
- use Illuminate\Auth\Reminders\RemindableTrait;
- use Illuminate\Auth\Reminders\RemindableInterface;
-
- use Zizaco\Entrust\HasRole;
-
- class User extends Eloquent implements UserInterface, RemindableInterface
- {
-
- use UserTrait, RemindableTrait, HasRole;
-
- /**
- * The database table used by the model.
- *
- * @var string
- */
- protected $table = 'users';
-
- /**
- * The attributes excluded from the model's JSON form.
- *
- * @var array
- */
- protected $hidden = array();
-
- /**
- * The attributes that can be massively assigned
- */
- protected $fillable = array('ssn', 'first_name', 'surnames', 'email', 'role', 'school_id', 'has_access', 'cell_phone', 'office_phone', 'office_extension');
-
- /**
- * Searchable rules.
- *
- * @var array
- */
- protected $searchable = [
- 'columns' => [
- 'first_name' => 10,
- 'surnames' => 10,
- 'email' => 2,
- ],
- ];
-
-
- public function program()
- {
- return $this->belongsTo('Program');
- }
-
- public function school()
- {
- return $this->belongsTo('School');
- }
-
- public function courses()
- {
- return $this->hasMany('Course')->whereIn('semester_id', Session::get('semesters_ids'))->orderBy('code')->orderBy('number')->orderBy('section')->orderBy('semester_id');
- }
-
- public function rubrics()
- {
- return $this->hasMany('Rubric')->orderBy('name');
- }
-
- // return the programs the user is a pcoord of
- public function programs()
- {
- return $this->belongsToMany('Program')->select('programs.id', 'programs.name', 'programs.school_id', 'programs.is_graduate');
- }
- }
|