fix: 🚚 Typo cancelled -> canceled

This commit is contained in:
IceToast 2023-06-08 16:10:42 +02:00
parent 820f47738d
commit e8a6adb4e6
7 changed files with 27 additions and 26 deletions

View file

@ -24,7 +24,7 @@ class ChargeServers extends Command
*/ */
protected $description = 'Charge all users with severs that are due to be charged'; protected $description = 'Charge all users with severs that are due to be charged';
/** /**
* A list of users that have to be notified * A list of users that have to be notified
* @var array * @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 // check if server is due to be charged by comparing its last_billed date with the current date and the billing period
$newBillingDate = null; $newBillingDate = null;
switch($billing_period) { switch ($billing_period) {
case 'annually': case 'annually':
$newBillingDate = Carbon::parse($server->last_billed)->addYear(); $newBillingDate = Carbon::parse($server->last_billed)->addYear();
break; 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 // 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 { try {
// suspend server // suspend server
$this->line("<fg=yellow>{$server->name}</> from user: <fg=blue>{$user->name}</> has been <fg=red>suspended!</>"); $this->line("<fg=yellow>{$server->name}</> from user: <fg=blue>{$user->name}</> has been <fg=red>suspended!</>");

View file

@ -25,7 +25,7 @@ class ServerController extends Controller
const WRITE_PERMISSION = "admin.servers.write"; const WRITE_PERMISSION = "admin.servers.write";
const SUSPEND_PERMISSION = "admin.servers.suspend"; const SUSPEND_PERMISSION = "admin.servers.suspend";
const CHANGEOWNER_PERMISSION = "admin.servers.write.owner"; 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"; const DELETE_PERMISSION = "admin.servers.delete";
private $pterodactyl; private $pterodactyl;
@ -100,7 +100,7 @@ class ServerController extends Controller
} }
// update the identifier // update the identifier
if($this->can(self::CHANGE_IDENTIFIER_PERMISSION)) { if ($this->can(self::CHANGE_IDENTIFIER_PERMISSION)) {
$server->identifier = $request->get('identifier'); $server->identifier = $request->get('identifier');
} }
@ -133,13 +133,13 @@ class ServerController extends Controller
* @param Server $server * @param Server $server
* @return RedirectResponse|Response * @return RedirectResponse|Response
*/ */
public function cancel (Server $server) public function cancel(Server $server)
{ {
try { try {
error_log($server->update([ $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) { } catch (Exception $e) {
return redirect()->route('servers.index')->with('error', __('An exception has occurred while trying to cancel the server"') . $e->getMessage() . '"'); return redirect()->route('servers.index')->with('error', __('An exception has occurred while trying to cancel the server"') . $e->getMessage() . '"');
} }

View file

@ -281,9 +281,9 @@ class ServerController extends Controller
} }
try { try {
$server->update([ $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) { } catch (Exception $e) {
return redirect()->route('servers.index')->with('error', __('An exception has occurred while trying to cancel the server"') . $e->getMessage() . '"'); 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, 'product_id' => $newProduct->id,
'updated_at' => now(), 'updated_at' => now(),
'last_billed' => now(), 'last_billed' => now(),
'cancelled' => null, 'canceled' => null,
]); ]);
// Refund the user the overpayed credits // Refund the user the overpayed credits

View file

@ -60,7 +60,7 @@ class Server extends Model
"product_id", "product_id",
"pterodactyl_id", "pterodactyl_id",
"last_billed", "last_billed",
"cancelled" "canceled"
]; ];
/** /**

View file

@ -98,8 +98,6 @@ class User extends Authenticatable implements MustVerifyEmail
$ptero_settings = new PterodactylSettings(); $ptero_settings = new PterodactylSettings();
$this->pterodactyl = new PterodactylClient($ptero_settings); $this->pterodactyl = new PterodactylClient($ptero_settings);
} }
public static function boot() public static function boot()
@ -252,7 +250,7 @@ class User extends Authenticatable implements MustVerifyEmail
{ {
return $this->servers() return $this->servers()
->whereNull('suspended') ->whereNull('suspended')
->whereNull('cancelled') ->whereNull('canceled')
->with('product') ->with('product')
->get(); ->get();
} }
@ -289,15 +287,15 @@ class User extends Authenticatable implements MustVerifyEmail
])->save(); ])->save();
} }
public function referredBy(){ public function referredBy()
$referee = DB::table('user_referrals')->where("registered_user_id",$this->id)->first(); {
$referee = DB::table('user_referrals')->where("registered_user_id", $this->id)->first();
if($referee){ if ($referee) {
$referee = User::where("id",$referee->referral_id)->firstOrFail(); $referee = User::where("id", $referee->referral_id)->firstOrFail();
return $referee; return $referee;
} }
return Null; return Null;
} }
public function getActivitylogOptions(): LogOptions public function getActivitylogOptions(): LogOptions

View file

@ -15,6 +15,9 @@ class AddCancelationToServersTable extends Migration
{ {
// User already has installed the addon before // User already has installed the addon before
if (Schema::hasColumn("servers", "cancelled")) { if (Schema::hasColumn("servers", "cancelled")) {
Schema::table('servers', function (Blueprint $table) {
$table->renameColumn('cancelled', 'canceled');
});
return; return;
} }
@ -31,7 +34,7 @@ class AddCancelationToServersTable extends Migration
public function down() public function down()
{ {
Schema::table('servers', function (Blueprint $table) { Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('cancelled'); $table->dropColumn('canceled');
}); });
} }
} }

View file

@ -82,8 +82,8 @@
<div class="col-7 my-auto"> <div class="col-7 my-auto">
@if($server->suspended) @if($server->suspended)
<span class="badge badge-danger">{{ __('Suspended') }}</span> <span class="badge badge-danger">{{ __('Suspended') }}</span>
@elseif($server->cancelled) @elseif($server->canceled)
<span class="badge badge-warning">{{ __('Cancelled') }}</span> <span class="badge badge-warning">{{ __('Canceled') }}</span>
@else @else
<span class="badge badge-success">{{ __('Active') }}</span> <span class="badge badge-success">{{ __('Active') }}</span>
@endif @endif
@ -220,7 +220,7 @@
</a> </a>
<button onclick="handleServerCancel('{{ $server->id }}');" target="__blank" <button onclick="handleServerCancel('{{ $server->id }}');" target="__blank"
class="btn btn-warning text-center" class="btn btn-warning text-center"
{{ $server->suspended || $server->cancelled ? "disabled" : "" }} {{ $server->suspended || $server->canceled ? "disabled" : "" }}
data-toggle="tooltip" data-placement="bottom" title="{{ __('Cancel Server') }}"> data-toggle="tooltip" data-placement="bottom" title="{{ __('Cancel Server') }}">
<i class="fas fa-ban mx-2"></i> <i class="fas fa-ban mx-2"></i>
</button> </button>