Time Difference

how can i implement difference of time here.
No description
1 Reply
Ron
Ron4mo ago
You could use https://filamentphp.com/docs/3.x/tables/columns/getting-started#calculated-state or simply define an accessor in your model and add a text column for the time difference (e.g. Add this to your model)

public function timeDiff(): Attribute {
return Attribute::get(fn() => $this->time_in->diffForHumans($this->time_out, CarbonInterface::DIFF_ABSOLUTE));
}

public function timeDiff(): Attribute {
return Attribute::get(fn() => $this->time_in->diffForHumans($this->time_out, CarbonInterface::DIFF_ABSOLUTE));
}
Want results from more Discord servers?
Add your server