<?php



namespace App\Models;



use Illuminate\Database\Eloquent\Factories\HasFactory;

use Illuminate\Database\Eloquent\Model;

use Illuminate\Foundation\Auth\User as Authenticatable;



use DB;





class Vendor extends Authenticatable

{

    use HasFactory;

    protected $table = 'vendor';



    protected $fillable = [

        'name_of_company',
        
        'user_id',
        
        'vendor_code',

        'tan_number',

        'tally_heading',

        'description_goods',

        'location',

        'msme_act',

        'activity',

        'udhyom',

        'date',

        'registraion_type',

        'gross_annual_sales',

        'legel_structure',

        'business_comoddity',

        'goods_supplied',

        'department_id',

        'authorised_person',

        'person_contactno',

        'vendor_list',

        'contact_person',

        'contact_number',

        'email',

        'password',

        'gst_no',

        'pan_no',

        'address',

        'bank_name',

        'account_no',

        'ifsc_code',

        'acc_holder_name',

        'account_type',

        'branch',

        'district',

        'state',

        'payment_mode',

        'working_year',

        'remark_1',

        'remark_2',

        'status',

        //'approval_status',

        'created_at',

        'created_by',

        'updated_by',

        'updated_at'

    ];

    protected $hidden = ['password', 'remember_token'];



    // public function export($slug){

    //     $collection = DB::table('car_model')

    //                     ->select('name', 'status','created_at');



    //     if($slug != 'all')

    //         $collection->where(['status' => $slug]);



    //     $data = $collection->get();



    //     if($data->isNotEmpty()){

    //         return $data;

    //     }else{

    //         return null;

    //     }

    // }



public function department()

{

    return $this->belongsTo(Department::class);

}

public function branch()

{

    return $this->belongsTo(Branch::class);

}

}

