- Add trial balance and general ledger pages to client resource with interactive tables - Implement sales and expenses relation managers for client-specific transactions - Enhance transaction handling with proper tax and withholding calculations - Add date casting to Transaction model and define client relationships - Configure super admin role bypass in AppServiceProvider - Update Filament components and fix JavaScript formatting issues
34 lines
808 B
PHP
34 lines
808 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\HasPeriod;
|
|
use App\Traits\HasUser;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Journal extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $casts = ['happened_on' => 'date'];
|
|
|
|
public function ledgers(): HasMany
|
|
{
|
|
return $this->hasMany(Ledger::class);
|
|
}
|
|
|
|
public function scopeDateCreatedFilter(Builder $query, $date) : Builder
|
|
{
|
|
$dates = explode(' to ',$date);
|
|
if (isset($dates[1])) {
|
|
return $query->whereBetween('happened_on' ,[$dates[0], $dates[1]]);
|
|
}
|
|
return $query->where('happened_on', $dates[0]);
|
|
}
|
|
}
|