|
@@ -177,6 +177,10 @@ class User extends Authenticatable implements MustVerifyEmail
|
|
|
*/
|
|
|
public function suspend()
|
|
|
{
|
|
|
+ foreach ($this->servers as $server){
|
|
|
+ $server->suspend();
|
|
|
+ }
|
|
|
+
|
|
|
$this->update([
|
|
|
'suspended' => true
|
|
|
]);
|
|
@@ -189,6 +193,12 @@ class User extends Authenticatable implements MustVerifyEmail
|
|
|
*/
|
|
|
public function unSuspend()
|
|
|
{
|
|
|
+ foreach ($this->servers as $server){
|
|
|
+ if ($this->credits >= $server->product->getHourlyPrice()) {
|
|
|
+ $server->unSuspend();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$this->update([
|
|
|
'suspended' => false
|
|
|
]);
|