2018-01-01 21:11:44 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Traits\Services;
|
|
|
|
|
|
|
|
trait ReturnsUpdatedModels
|
|
|
|
{
|
2022-10-14 17:59:20 +01:00
|
|
|
private bool $updatedModel = false;
|
2018-01-01 21:11:44 +00:00
|
|
|
|
2022-10-14 17:59:20 +01:00
|
|
|
public function getUpdatedModel(): bool
|
2018-01-01 21:11:44 +00:00
|
|
|
{
|
|
|
|
return $this->updatedModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If called a fresh model will be returned from the database. This is used
|
|
|
|
* for API calls, but is unnecessary for UI based updates where the page is
|
|
|
|
* being reloaded and a fresh model will be pulled anyways.
|
|
|
|
*/
|
2022-10-14 17:59:20 +01:00
|
|
|
public function returnUpdatedModel(bool $toggle = true): self
|
2018-01-01 21:11:44 +00:00
|
|
|
{
|
|
|
|
$this->updatedModel = $toggle;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|