diff --git a/app/Console/Commands/ChargeServers.php b/app/Console/Commands/ChargeServers.php index 014af963..8c7b9d4d 100644 --- a/app/Console/Commands/ChargeServers.php +++ b/app/Console/Commands/ChargeServers.php @@ -24,7 +24,7 @@ class ChargeServers extends Command */ protected $description = 'Charge all users with severs that are due to be charged'; - /** + /** * A list of users that have to be notified * @var array */ @@ -60,7 +60,7 @@ class ChargeServers extends Command // check if server is due to be charged by comparing its last_billed date with the current date and the billing period $newBillingDate = null; - switch($billing_period) { + switch ($billing_period) { case 'annually': $newBillingDate = Carbon::parse($server->last_billed)->addYear(); break; @@ -91,7 +91,7 @@ class ChargeServers extends Command } // check if the server is canceled or if user has enough credits to charge the server or - if ( $server->cancelled || $user->credits <= $product->price) { + if ($server->canceled || $user->credits <= $product->price) { try { // suspend server $this->line("{$server->name} from user: {$user->name} has been suspended!"); diff --git a/app/Http/Controllers/Admin/ServerController.php b/app/Http/Controllers/Admin/ServerController.php index 9efd70f0..97ee1553 100644 --- a/app/Http/Controllers/Admin/ServerController.php +++ b/app/Http/Controllers/Admin/ServerController.php @@ -25,7 +25,7 @@ class ServerController extends Controller const WRITE_PERMISSION = "admin.servers.write"; const SUSPEND_PERMISSION = "admin.servers.suspend"; const CHANGEOWNER_PERMISSION = "admin.servers.write.owner"; - const CHANGE_IDENTIFIER_PERMISSION ="admin.servers.write.identifier"; + const CHANGE_IDENTIFIER_PERMISSION = "admin.servers.write.identifier"; const DELETE_PERMISSION = "admin.servers.delete"; private $pterodactyl; @@ -100,7 +100,7 @@ class ServerController extends Controller } // update the identifier - if($this->can(self::CHANGE_IDENTIFIER_PERMISSION)) { + if ($this->can(self::CHANGE_IDENTIFIER_PERMISSION)) { $server->identifier = $request->get('identifier'); } @@ -133,13 +133,13 @@ class ServerController extends Controller * @param Server $server * @return RedirectResponse|Response */ - public function cancel (Server $server) + public function cancel(Server $server) { try { - error_log($server->update([ - 'cancelled' => now(), - ])); - return redirect()->route('servers.index')->with('success', __('Server cancelled')); + $server->update([ + 'canceled' => now(), + ]); + return redirect()->route('servers.index')->with('success', __('Server canceled')); } catch (Exception $e) { return redirect()->route('servers.index')->with('error', __('An exception has occurred while trying to cancel the server"') . $e->getMessage() . '"'); } diff --git a/app/Http/Controllers/ServerController.php b/app/Http/Controllers/ServerController.php index 5380e10b..d291e298 100644 --- a/app/Http/Controllers/ServerController.php +++ b/app/Http/Controllers/ServerController.php @@ -281,9 +281,9 @@ class ServerController extends Controller } try { $server->update([ - 'cancelled' => now(), + 'canceled' => now(), ]); - return redirect()->route('servers.index')->with('success', __('Server cancelled')); + return redirect()->route('servers.index')->with('success', __('Server canceled')); } catch (Exception $e) { return redirect()->route('servers.index')->with('error', __('An exception has occurred while trying to cancel the server"') . $e->getMessage() . '"'); } @@ -401,7 +401,7 @@ class ServerController extends Controller 'product_id' => $newProduct->id, 'updated_at' => now(), 'last_billed' => now(), - 'cancelled' => null, + 'canceled' => null, ]); // Refund the user the overpayed credits diff --git a/app/Models/Server.php b/app/Models/Server.php index 07acc08a..bd70c536 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -60,7 +60,7 @@ class Server extends Model "product_id", "pterodactyl_id", "last_billed", - "cancelled" + "canceled" ]; /** diff --git a/app/Models/User.php b/app/Models/User.php index 6d14f585..2c632e3c 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -98,8 +98,6 @@ class User extends Authenticatable implements MustVerifyEmail $ptero_settings = new PterodactylSettings(); $this->pterodactyl = new PterodactylClient($ptero_settings); - - } public static function boot() @@ -252,7 +250,7 @@ class User extends Authenticatable implements MustVerifyEmail { return $this->servers() ->whereNull('suspended') - ->whereNull('cancelled') + ->whereNull('canceled') ->with('product') ->get(); } @@ -289,15 +287,15 @@ class User extends Authenticatable implements MustVerifyEmail ])->save(); } - public function referredBy(){ - $referee = DB::table('user_referrals')->where("registered_user_id",$this->id)->first(); + public function referredBy() + { + $referee = DB::table('user_referrals')->where("registered_user_id", $this->id)->first(); - if($referee){ - $referee = User::where("id",$referee->referral_id)->firstOrFail(); + if ($referee) { + $referee = User::where("id", $referee->referral_id)->firstOrFail(); return $referee; } return Null; - } public function getActivitylogOptions(): LogOptions diff --git a/database/migrations/2023_05_08_234527_add_cancelation_to_servers_table.php b/database/migrations/2023_05_08_234527_add_cancelation_to_servers_table.php index 0d0f4e20..b26b19cc 100644 --- a/database/migrations/2023_05_08_234527_add_cancelation_to_servers_table.php +++ b/database/migrations/2023_05_08_234527_add_cancelation_to_servers_table.php @@ -15,6 +15,9 @@ class AddCancelationToServersTable extends Migration { // User already has installed the addon before if (Schema::hasColumn("servers", "cancelled")) { + Schema::table('servers', function (Blueprint $table) { + $table->renameColumn('cancelled', 'canceled'); + }); return; } @@ -31,7 +34,7 @@ class AddCancelationToServersTable extends Migration public function down() { Schema::table('servers', function (Blueprint $table) { - $table->dropColumn('cancelled'); + $table->dropColumn('canceled'); }); } } diff --git a/themes/default/views/servers/index.blade.php b/themes/default/views/servers/index.blade.php index 09858c67..f7c2cec5 100644 --- a/themes/default/views/servers/index.blade.php +++ b/themes/default/views/servers/index.blade.php @@ -82,8 +82,8 @@
@if($server->suspended) {{ __('Suspended') }} - @elseif($server->cancelled) - {{ __('Cancelled') }} + @elseif($server->canceled) + {{ __('Canceled') }} @else {{ __('Active') }} @endif @@ -220,7 +220,7 @@