<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
    protected $fillable = [
        "name", "description", "company_id"
    ];

    protected $hidden = ["pivot"];

    public function company() {
        return $this->belongsTo("App\Company", "company_id");
    }

    public function user_subscriptions() {
        return $this->hasMany("App\UserSubscription", "role_id");
    }

    public function isAthlete() {
        return $this->slug == "athlete";
    }

    public function isCoach() {
        return $this->slug == "coach";
    }

    public function isBoxAdmin() {
        return $this->slug == "box_admin";
    }

    public function isCompanyAdmin() {
        return $this->slug == "company_admin";
    }

    public function isSuperAdmin() {
        return $this->slug == "super_admin";
    }

}
