<?php

namespace Hilco\Models;

use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class WebPermission extends Model {

	protected $table = 'WebPermissions';
	protected $fillable = ['name', 'slug', 'description', 'is_enabled'];
    public $timestamps = false;

    public function webUsers()
	{
		return $this->belongsToMany(WebUser::class, 'WebPermission_WebUser')->wherePivot('deleted_at', '=', '0000-00-00 00:00:00');
	}

	public function webRoles()
	{
		return $this->belongsToMany(WebRole::class, 'WebPermission_WebRole', 'webpermission_id', 'webrole_id')->wherePivot('deleted_at', '=', '0000-00-00 00:00:00');
	}
}