Finish first round of User/Node API additions
Will still need some tweaking and improvements to allow everything to be used.
This commit is contained in:
parent
d21f70c04b
commit
15289b76a7
10 changed files with 220 additions and 68 deletions
35
app/Traits/Services/ReturnsUpdatedModels.php
Normal file
35
app/Traits/Services/ReturnsUpdatedModels.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Traits\Services;
|
||||
|
||||
trait ReturnsUpdatedModels
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $updatedModel = false;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getUpdatedModel()
|
||||
{
|
||||
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.
|
||||
*
|
||||
* @param bool $toggle
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function returnUpdatedModel(bool $toggle = true)
|
||||
{
|
||||
$this->updatedModel = $toggle;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue