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';
/**
/**
* 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("<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 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() . '"');
}

View file

@ -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

View file

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

View file

@ -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

View file

@ -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');
});
}
}

View file

@ -82,8 +82,8 @@
<div class="col-7 my-auto">
@if($server->suspended)
<span class="badge badge-danger">{{ __('Suspended') }}</span>
@elseif($server->cancelled)
<span class="badge badge-warning">{{ __('Cancelled') }}</span>
@elseif($server->canceled)
<span class="badge badge-warning">{{ __('Canceled') }}</span>
@else
<span class="badge badge-success">{{ __('Active') }}</span>
@endif
@ -220,7 +220,7 @@
</a>
<button onclick="handleServerCancel('{{ $server->id }}');" target="__blank"
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') }}">
<i class="fas fa-ban mx-2"></i>
</button>