working timers
This commit is contained in:
@@ -36,7 +36,7 @@ class TicketTimer extends Component
|
|||||||
/**
|
/**
|
||||||
* Start a database-backed timer for the current authenticated user.
|
* Start a database-backed timer for the current authenticated user.
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
public function startTimer(): void
|
public function startTimer(): void
|
||||||
{
|
{
|
||||||
@@ -78,7 +78,7 @@ class TicketTimer extends Component
|
|||||||
/**
|
/**
|
||||||
* End the current user's active timer and persist seconds/minutes.
|
* End the current user's active timer and persist seconds/minutes.
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
public function endTimer(): void
|
public function endTimer(): void
|
||||||
{
|
{
|
||||||
@@ -92,9 +92,10 @@ class TicketTimer extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
$endedAt = Carbon::now();
|
$endedAt = Carbon::now();
|
||||||
$seconds = max(1, (int) $timer->started_at->diffInSeconds($endedAt));
|
|
||||||
$minutes = (int) ceil($seconds / 60);
|
|
||||||
$description = trim($this->description) !== '' ? trim($this->description) : $timer->description;
|
$description = trim($this->description) !== '' ? trim($this->description) : $timer->description;
|
||||||
|
$seconds = max(1, (int) $timer->started_at->diffInSeconds($endedAt));
|
||||||
|
|
||||||
|
$minutes = (int) ceil($seconds / 60);
|
||||||
|
|
||||||
$timer->forceFill([
|
$timer->forceFill([
|
||||||
'ended_at' => $endedAt,
|
'ended_at' => $endedAt,
|
||||||
@@ -163,7 +164,7 @@ class TicketTimer extends Component
|
|||||||
/**
|
/**
|
||||||
* Return the authenticated user or fail validation cleanly.
|
* Return the authenticated user or fail validation cleanly.
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
private function authenticatedUser(): Authenticatable
|
private function authenticatedUser(): Authenticatable
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user