<?php

namespace App\Models;

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

class Asset extends Model
{
    use HasFactory;
    protected $fillable = [
        'item_name',
        'amount',
    ];

    public function export($slug){
        $collection = DB::table('assets')->select('item_name','amount');

        /*if($slug != 'all')
            $collection->where(['status' => $slug]);*/
        
        $data = $collection->get();
        
        if($data->isNotEmpty()){
            return $data;
        }else{
            return null;
        }
    }
}
