bhattji
How to set date of the DatePicker component?
I wish to set the Maturity date when the Loan Date is entered. I have written the code as below
->reactive()
->afterStateUpdated(function (callable $get, callable $set) {
$scheme = \App\Models\Scheme::find($get('scheme_id'));
if ($scheme){
$set('maturity_date', \Carbon\Carbon::parse($scheme->loan_date)->addDays($scheme->days));
}
})
but it is not working 😦
How to set date of the DatePicker component?
2 replies
How to group Item in Report Plugin
I am trying to use this Report Plugin https://github.com/eighty9nine/filament-reports
Instead of listing Location as column I would like to put it as Group an list items for the Location beneath it. The owner gave this suggestion to use map, but it seems there is some missing bracket somewhere https://github.com/eighty9nine/filament-reports/issues/24#issuecomment-2263863220
public function body(Body $body): Body
{
return $body
->schema([
...Location::all()
->map( fn(Location $location) => [
Text::make($location->name),
Body\Table::make()
->data(
fn(?array $filters) => User::join("locations", "location.id", "=", "users.location_id")
->where("users.deleted_at", null)
->where("users.location_id", $location->id)
->when(isset($filters["location_id"], fn($query) => $query->where("users.location_id", $filters["location_id"]))
->select("users.name", "users.email", "locations.name")
->get()
),
])
]);
}
Can someone please help?
2 replies
How to bypass database violations?
I have a table with unique index, I am trying to update the model in a try-catch block
$exceptions = 0;
try {
AssetDepreciation::updateOrCreate([
'asset_id' => $asset->id,
'as_on' => $data['as_on_date'],
'depreciated_value' => (($asset->asset_depreciations()->count() > 0 ? $asset->asset_depreciations()->orderBy('as_on','desc')->first()->depreciated_value : $asset->purchase_value) * (100 - $asset->depreciation_percentage) / 100),
]);
} catch (Exception $e) {
$exceptions++;
}
but it does not bypass "SQLSTATE[23000]: Integrity constraint violation:"
why?
6 replies
Target [Illuminate\Database\Eloquent\Model] is not instantiable
I have the UserResource, which I guess, working all fine sometime before, however I find now I am not abe to create a new User (Target [Illuminate\Database\Eloquent\Model] is not instantiable.)
The EditUser works fine though
How to solve this?
Please help asap
12 replies