<?php

namespace App\Models;

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

class CajaMovimiento extends Model
{
    use HasFactory;

    const CODIGO_CAJA = 1, CODIGO_RETIRO = 2;

    protected $fillable = [
        'cantidad',
        'estado_caja_movimiento_id',
        'user_id',
    ];


    public static function cajaInicial()
    {
        return CajaMovimiento::where([
            ['user_id','=',auth()->user()->id],
            ['created_at', '>=', Carbon::now()->startOfDay()],
            ['created_at', '<=', Carbon::now()->endOfDay()],
        ])->get();
    }
}
