<?php

namespace App;

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

class Branch extends Model 
{

    protected $table = 'branches';
    public $timestamps = true;

    use SoftDeletes;

    protected $dates = ['deleted_at'];
    protected $fillable = array('name','image', 'description', 'address', 'phone', 'lat', 'lan');

    public function details()
    {
        return $this->hasMany('App\BranchDetail');
    }

    public function specialties()
    {
        return $this->belongsToMany('App\SpecialtyBranch','specialty_branches','branch_id','specialty_id');
    }

    public function user()
    {
        return $this->belongsToMany('App\BranchUser');
    }

}