<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use DB;

class Pettycashexpense extends Model{
    use HasFactory;
    protected $table = 'petty_cash_expense';
    
    protected $fillable = [
        'expense_type_id',
        'pay_to',
        'decription',
        'department_id',
        'amount',
        'created_at',
        'updated_at',
        'created_by',
        'updated_by'
    ];

    public function export($slug){
        $collection = DB::table('petty_cash_expense') ->select('expense_title', 'amount');
        
        $data = $collection->get();
                
        if($data->isNotEmpty()){
            return $data;
        }else{
            return null;
        }
    }
}
