Closes #696
This commit is contained in:
parent
a75863909c
commit
654932225a
15 changed files with 196 additions and 83 deletions
|
@ -185,29 +185,32 @@ class CouponController extends Controller
|
|||
|
||||
public function dataTable()
|
||||
{
|
||||
$query = Coupon::query();
|
||||
$query = Coupon::selectRaw('
|
||||
coupons.*,
|
||||
CASE
|
||||
WHEN coupons.uses >= coupons.max_uses THEN "USES_LIMIT_REACHED"
|
||||
WHEN coupons.expires_at IS NOT NULL AND coupons.expires_at < NOW() THEN "EXPIRED"
|
||||
ELSE "VALID"
|
||||
END as derived_status
|
||||
');
|
||||
|
||||
return datatables($query)
|
||||
->addColumn('actions', function(Coupon $coupon) {
|
||||
return '
|
||||
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.coupons.edit', $coupon->id).'" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
||||
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.coupons.edit', $coupon->id).'" class="mr-1 btn btn-sm btn-info"><i class="fas fa-pen"></i></a>
|
||||
|
||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="'.route('admin.coupons.destroy', $coupon->id).'">
|
||||
'.csrf_field().'
|
||||
'.method_field('DELETE').'
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="mr-1 btn btn-sm btn-danger"><i class="fas fa-trash"></i></button>
|
||||
</form>
|
||||
';
|
||||
})
|
||||
->addColumn('status', function(Coupon $coupon) {
|
||||
$color = 'success';
|
||||
$status = $coupon->getStatus();
|
||||
->addColumn('status', function (Coupon $coupon) {
|
||||
$color = ($coupon->derived_status == 'VALID') ? 'success' : 'danger';
|
||||
$status = str_replace('_', ' ', $coupon->derived_status);
|
||||
|
||||
if ($status != __('VALID')) {
|
||||
$color = 'danger';
|
||||
}
|
||||
|
||||
return '<span class="badge badge-'.$color.'">'.str_replace('_', ' ', $status).'</span>';
|
||||
return '<span class="badge badge-'.$color.'">'.$status.'</span>';
|
||||
})
|
||||
->editColumn('uses', function (Coupon $coupon) {
|
||||
return "{$coupon->uses} / {$coupon->max_uses}";
|
||||
|
@ -232,6 +235,7 @@ class CouponController extends Controller
|
|||
->editColumn('code', function (Coupon $coupon) {
|
||||
return "<code>{$coupon->code}</code>";
|
||||
})
|
||||
->orderColumn('status', 'derived_status $1')
|
||||
->rawColumns(['actions', 'code', 'status'])
|
||||
->make();
|
||||
}
|
||||
|
|
|
@ -122,11 +122,11 @@ class PartnerController extends Controller
|
|||
return datatables($query)
|
||||
->addColumn('actions', function (PartnerDiscount $partner) {
|
||||
return '
|
||||
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.partners.edit', $partner->id).'" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
||||
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.partners.edit', $partner->id).'" class="mr-1 btn btn-sm btn-info"><i class="fas fa-pen"></i></a>
|
||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="'.route('admin.partners.destroy', $partner->id).'">
|
||||
'.csrf_field().'
|
||||
'.method_field('DELETE').'
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="mr-1 btn btn-sm btn-danger"><i class="fas fa-trash"></i></button>
|
||||
</form>
|
||||
';
|
||||
})
|
||||
|
@ -145,6 +145,7 @@ class PartnerController extends Controller
|
|||
->editColumn('referral_system_commission', function (PartnerDiscount $partner, ReferralSettings $referral_settings) {
|
||||
return $partner->referral_system_commission >= 0 ? $partner->referral_system_commission . '%' : __('Default') . ' ('.$referral_settings->percentage . '%)';
|
||||
})
|
||||
->orderColumn('user', 'user_id $1')
|
||||
->rawColumns(['user', 'actions'])
|
||||
->make();
|
||||
}
|
||||
|
|
|
@ -223,17 +223,18 @@ class ProductController extends Controller
|
|||
public function dataTable()
|
||||
{
|
||||
$query = Product::with(['servers']);
|
||||
|
||||
return datatables($query)
|
||||
->addColumn('actions', function (Product $product) {
|
||||
return '
|
||||
<a data-content="'.__('Show').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.products.show', $product->id).'" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-eye"></i></a>
|
||||
<a data-content="'.__('Clone').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.products.clone', $product->id).'" class="btn btn-sm text-white btn-primary mr-1"><i class="fas fa-clone"></i></a>
|
||||
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.products.edit', $product->id).'" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
||||
<a data-content="'.__('Show').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.products.show', $product->id).'" class="mr-1 text-white btn btn-sm btn-warning"><i class="fas fa-eye"></i></a>
|
||||
<a data-content="'.__('Clone').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.products.clone', $product->id).'" class="mr-1 text-white btn btn-sm btn-primary"><i class="fas fa-clone"></i></a>
|
||||
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.products.edit', $product->id).'" class="mr-1 btn btn-sm btn-info"><i class="fas fa-pen"></i></a>
|
||||
|
||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="'.route('admin.products.destroy', $product->id).'">
|
||||
'.csrf_field().'
|
||||
'.method_field('DELETE').'
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="mr-1 btn btn-sm btn-danger"><i class="fas fa-trash"></i></button>
|
||||
</form>
|
||||
';
|
||||
})
|
||||
|
@ -247,7 +248,7 @@ class ProductController extends Controller
|
|||
->addColumn('eggs', function (Product $product) {
|
||||
return $product->eggs()->count();
|
||||
})
|
||||
->addColumn('disabled', function (Product $product) {
|
||||
->editColumn('disabled', function (Product $product) {
|
||||
$checked = $product->disabled == false ? 'checked' : '';
|
||||
|
||||
return '
|
||||
|
@ -264,7 +265,7 @@ class ProductController extends Controller
|
|||
->editColumn('minimum_credits', function (Product $product, UserSettings $user_settings) {
|
||||
return $product->minimum_credits==-1 ? $user_settings->min_credits_to_make_server : $product->minimum_credits;
|
||||
})
|
||||
->editColumn('oom_killer', function (Product $product, UserSettings $user_settings) {
|
||||
->editColumn('oom_killer', function (Product $product) {
|
||||
return $product->oom_killer ? __("enabled") : __("disabled");
|
||||
})
|
||||
->editColumn('created_at', function (Product $product) {
|
||||
|
|
|
@ -214,6 +214,8 @@ class RoleController extends Controller
|
|||
->editColumn('power', function (Role $role){
|
||||
return $role->power;
|
||||
})
|
||||
->orderColumn('usercount', 'users_count $1')
|
||||
->orderColumn('permissionscount', 'permissions_count $1')
|
||||
->rawColumns(['actions', 'name'])
|
||||
->make(true);
|
||||
}
|
||||
|
|
|
@ -156,16 +156,16 @@ class ShopProductController extends Controller
|
|||
return datatables($query)
|
||||
->addColumn('actions', function (ShopProduct $shopProduct) {
|
||||
return '
|
||||
<a data-content="' . __('Edit') . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.store.edit', $shopProduct->id) . '" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
||||
<a data-content="' . __('Edit') . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.store.edit', $shopProduct->id) . '" class="mr-1 btn btn-sm btn-info"><i class="fas fa-pen"></i></a>
|
||||
|
||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.destroy', $shopProduct->id) . '">
|
||||
' . csrf_field() . '
|
||||
' . method_field('DELETE') . '
|
||||
<button data-content="' . __('Delete') . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
|
||||
<button data-content="' . __('Delete') . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="mr-1 btn btn-sm btn-danger"><i class="fas fa-trash"></i></button>
|
||||
</form>
|
||||
';
|
||||
})
|
||||
->addColumn('disabled', function (ShopProduct $shopProduct) {
|
||||
->editColumn('disabled', function (ShopProduct $shopProduct) {
|
||||
$checked = $shopProduct->disabled == false ? 'checked' : '';
|
||||
|
||||
return '
|
||||
|
|
|
@ -121,11 +121,12 @@ class TicketsController extends Controller
|
|||
|
||||
public function dataTable()
|
||||
{
|
||||
$query = Ticket::query();
|
||||
$query = Ticket::leftJoin('ticket_categories', 'tickets.ticketcategory_id', '=', 'ticket_categories.id')
|
||||
->select(['tickets.*', 'ticket_categories.name as category_name']);
|
||||
|
||||
return datatables($query)
|
||||
->addColumn('category', function (Ticket $tickets) {
|
||||
return $tickets->ticketcategory->name;
|
||||
->addColumn('category', function (Ticket $ticket) {
|
||||
return $ticket->category_name;
|
||||
})
|
||||
->editColumn('title', function (Ticket $tickets) {
|
||||
return '<a class="text-info" href="'.route('admin.ticket.show', ['ticket_id' => $tickets->ticket_id]).'">'.'#'.$tickets->ticket_id.' - '.htmlspecialchars($tickets->title).'</a>';
|
||||
|
@ -139,16 +140,16 @@ class TicketsController extends Controller
|
|||
$statusButtonText = ($tickets->status == "Closed") ? __('Reopen') : __('Close');
|
||||
|
||||
return '
|
||||
<a data-content="'.__('View').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.ticket.show', ['ticket_id' => $tickets->ticket_id]).'" class="btn btn-sm text-white btn-info mr-1"><i class="fas fa-eye"></i></a>
|
||||
<a data-content="'.__('View').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.ticket.show', ['ticket_id' => $tickets->ticket_id]).'" class="mr-1 text-white btn btn-sm btn-info"><i class="fas fa-eye"></i></a>
|
||||
<form class="d-inline" method="post" action="'.route('admin.ticket.changeStatus', ['ticket_id' => $tickets->ticket_id]).'">
|
||||
'.csrf_field().'
|
||||
'.method_field('POST').'
|
||||
<button data-content="'.__($statusButtonText).'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm text-white '.$statusButtonColor.' mr-1"><i class="fas '.$statusButtonIcon.'"></i></button>
|
||||
<button data-content="'.__($statusButtonText).'" data-toggle="popover" data-trigger="hover" data-placement="top" class="text-white btn btn-sm '.$statusButtonColor.' mr-1"><i class="fas '.$statusButtonIcon.'"></i></button>
|
||||
</form>
|
||||
<form class="d-inline" method="post" action="'.route('admin.ticket.delete', ['ticket_id' => $tickets->ticket_id]).'">
|
||||
'.csrf_field().'
|
||||
'.method_field('POST').'
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm text-white btn-danger mr-1"><i class="fas fa-trash"></i></button>
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="mr-1 text-white btn btn-sm btn-danger"><i class="fas fa-trash"></i></button>
|
||||
</form>
|
||||
';
|
||||
})
|
||||
|
@ -178,7 +179,8 @@ class TicketsController extends Controller
|
|||
return ['display' => $tickets->updated_at ? $tickets->updated_at->diffForHumans() : '',
|
||||
'raw' => $tickets->updated_at ? strtotime($tickets->updated_at) : ''];
|
||||
})
|
||||
->rawColumns(['category', 'title', 'user_id', 'status', 'priority', 'updated_at', 'actions'])
|
||||
->orderColumn('category', 'category_name $1')
|
||||
->rawColumns(['title', 'user_id', 'status', 'priority', 'updated_at', 'actions'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
@ -279,12 +281,12 @@ class TicketsController extends Controller
|
|||
<form class="d-inline" method="post" action="'.route('admin.ticket.blacklist.change', ['id' => $blacklist->id]).'">
|
||||
'.csrf_field().'
|
||||
'.method_field('POST').'
|
||||
<button data-content="'.__('Change Status').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-sync-alt"></i></button>
|
||||
<button data-content="'.__('Change Status').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="mr-1 text-white btn btn-sm btn-warning"><i class="fas fa-sync-alt"></i></button>
|
||||
</form>
|
||||
<form class="d-inline" method="post" action="'.route('admin.ticket.blacklist.delete', ['id' => $blacklist->id]).'">
|
||||
'.csrf_field().'
|
||||
'.method_field('POST').'
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm text-white btn-danger mr-1"><i class="fas fa-trash"></i></button>
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="mr-1 text-white btn btn-sm btn-danger"><i class="fas fa-trash"></i></button>
|
||||
</form>
|
||||
';
|
||||
})
|
||||
|
|
|
@ -148,7 +148,7 @@ class UserController extends Controller
|
|||
*/
|
||||
public function update(Request $request, User $user)
|
||||
{
|
||||
$request->validate([
|
||||
$data = $request->validate([
|
||||
'name' => 'required|string|min:4|max:30',
|
||||
'pterodactyl_id' => "required|numeric|unique:users,pterodactyl_id,{$user->id}",
|
||||
'email' => 'required|string|email',
|
||||
|
@ -179,23 +179,23 @@ class UserController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
if($this->can(self::CHANGE_USERNAME_PERMISSION)){
|
||||
$user->name = $request->name;
|
||||
}
|
||||
if($this->can(self::CHANGE_CREDITS_PERMISSION)){
|
||||
$user->credits = $request->credits;
|
||||
}
|
||||
if($this->can(self::CHANGE_PTERO_PERMISSION)){
|
||||
$user->pterodactyl_id = $request->pterodactyl_id;
|
||||
}
|
||||
if($this->can(self::CHANGE_REFERAL_PERMISSION)){
|
||||
$user->referral_code = $request->referral_code;
|
||||
}
|
||||
if($this->can(self::CHANGE_EMAIL_PERMISSION)){
|
||||
$user->email = $request->email;
|
||||
}
|
||||
// if($this->can(self::CHANGE_USERNAME_PERMISSION)){
|
||||
// $user->name = $request->name;
|
||||
// }
|
||||
// if($this->can(self::CHANGE_CREDITS_PERMISSION)){
|
||||
// $user->credits = $request->credits;
|
||||
// }
|
||||
// if($this->can(self::CHANGE_PTERO_PERMISSION)){
|
||||
// $user->pterodactyl_id = $request->pterodactyl_id;
|
||||
// }
|
||||
// if($this->can(self::CHANGE_REFERAL_PERMISSION)){
|
||||
// $user->referral_code = $request->referral_code;
|
||||
// }
|
||||
// if($this->can(self::CHANGE_EMAIL_PERMISSION)){
|
||||
// $user->email = $request->email;
|
||||
// }
|
||||
|
||||
$user->save();
|
||||
$user->update($data);
|
||||
|
||||
event(new UserUpdateCreditsEvent($user));
|
||||
|
||||
|
@ -358,10 +358,12 @@ class UserController extends Controller
|
|||
*/
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$query = User::with('discordUser')->withCount('servers');
|
||||
// manually count referrals in user_referrals table
|
||||
$query->selectRaw('users.*, (SELECT COUNT(*) FROM user_referrals WHERE user_referrals.referral_id = users.id) as referrals_count');
|
||||
|
||||
$query = User::query()
|
||||
->withCount('servers')
|
||||
->leftJoin('model_has_roles', 'users.id', '=', 'model_has_roles.model_id')
|
||||
->leftJoin('roles', 'model_has_roles.role_id', '=', 'roles.id')
|
||||
->selectRaw('users.*, roles.name as role_name, (SELECT COUNT(*) FROM user_referrals WHERE user_referrals.referral_id = users.id) as referrals_count')
|
||||
->where('model_has_roles.model_type', User::class);
|
||||
|
||||
return datatables($query)
|
||||
->addColumn('avatar', function (User $user) {
|
||||
|
@ -412,6 +414,7 @@ class UserController extends Controller
|
|||
->editColumn('name', function (User $user, PterodactylSettings $ptero_settings) {
|
||||
return '<a class="text-info" target="_blank" href="' . $ptero_settings->panel_url . '/admin/users/view/' . $user->pterodactyl_id . '">' . strip_tags($user->name) . '</a>';
|
||||
})
|
||||
->orderColumn('role', 'role_name $1')
|
||||
->rawColumns(['avatar', 'name', 'credits', 'role', 'usage', 'actions'])
|
||||
->make();
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ class VoucherController extends Controller
|
|||
return '<a class="text-info" target="_blank" href="'.route('admin.users.show', $user->id).'">'.$user->name.'</a>';
|
||||
})
|
||||
->addColumn('credits', function (User $user) {
|
||||
return '<i class="fas fa-coins mr-2"></i> '.$user->credits();
|
||||
return '<i class="mr-2 fas fa-coins"></i> '.$user->credits();
|
||||
})
|
||||
->addColumn('last_seen', function (User $user) {
|
||||
return $user->last_seen ? $user->last_seen->diffForHumans() : '';
|
||||
|
@ -214,28 +214,33 @@ class VoucherController extends Controller
|
|||
|
||||
public function dataTable()
|
||||
{
|
||||
$query = Voucher::query();
|
||||
$query = Voucher::selectRaw('
|
||||
vouchers.*,
|
||||
CASE
|
||||
WHEN (SELECT COUNT(*) FROM user_voucher WHERE user_voucher.voucher_id = vouchers.id) >= vouchers.uses THEN "USES_LIMIT_REACHED"
|
||||
WHEN vouchers.expires_at IS NOT NULL AND vouchers.expires_at < NOW() THEN "EXPIRED"
|
||||
ELSE "VALID"
|
||||
END as derived_status
|
||||
');
|
||||
|
||||
return datatables($query)
|
||||
->addColumn('actions', function (Voucher $voucher) {
|
||||
return '
|
||||
<a data-content="'.__('Users').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.vouchers.users', $voucher->id).'" class="btn btn-sm btn-primary mr-1"><i class="fas fa-users"></i></a>
|
||||
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.vouchers.edit', $voucher->id).'" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
||||
<a data-content="'.__('Users').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.vouchers.users', $voucher->id).'" class="mr-1 btn btn-sm btn-primary"><i class="fas fa-users"></i></a>
|
||||
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.vouchers.edit', $voucher->id).'" class="mr-1 btn btn-sm btn-info"><i class="fas fa-pen"></i></a>
|
||||
|
||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="'.route('admin.vouchers.destroy', $voucher->id).'">
|
||||
'.csrf_field().'
|
||||
'.method_field('DELETE').'
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
|
||||
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="mr-1 btn btn-sm btn-danger"><i class="fas fa-trash"></i></button>
|
||||
</form>
|
||||
';
|
||||
})
|
||||
->addColumn('status', function (Voucher $voucher) {
|
||||
$color = 'success';
|
||||
if ($voucher->getStatus() != __('VALID')) {
|
||||
$color = 'danger';
|
||||
}
|
||||
$color = ($voucher->derived_status == 'VALID') ? 'success' : 'danger';
|
||||
$status = str_replace('_', ' ', $voucher->derived_status);
|
||||
|
||||
return '<span class="badge badge-'.$color.'">'.$voucher->getStatus().'</span>';
|
||||
return '<span class="badge badge-'.$color.'">'.$status.'</span>';
|
||||
})
|
||||
->editColumn('uses', function (Voucher $voucher) {
|
||||
return "{$voucher->used} / {$voucher->uses}";
|
||||
|
@ -253,6 +258,7 @@ class VoucherController extends Controller
|
|||
->editColumn('code', function (Voucher $voucher) {
|
||||
return "<code>{$voucher->code}</code>";
|
||||
})
|
||||
->orderColumn('status', 'derived_status $1')
|
||||
->rawColumns(['actions', 'code', 'status'])
|
||||
->make();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- CONTENT HEADER -->
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="mb-2 row">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{__('Coupons')}}</h1>
|
||||
</div>
|
||||
|
@ -31,7 +31,7 @@
|
|||
{{__('Coupons')}}
|
||||
</h5>
|
||||
<a href="{{route('admin.coupons.create')}}" class="btn btn-sm btn-primary">
|
||||
<i class="fas fa-plus mr-1"></i>
|
||||
<i class="mr-1 fas fa-plus"></i>
|
||||
{{__('Create new')}}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -82,7 +82,7 @@
|
|||
{data: 'status'},
|
||||
{data: 'code'},
|
||||
{data: 'value'},
|
||||
{data: 'uses'},
|
||||
{data: 'uses', sortable: false},
|
||||
{data: 'expires_at'},
|
||||
{data: 'created_at'},
|
||||
{data: 'actions', sortable: false},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- CONTENT HEADER -->
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="mb-2 row">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{__('Products')}}</h1>
|
||||
</div>
|
||||
|
@ -30,9 +30,9 @@
|
|||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<h5 class="card-title"><i class="fas fa-sliders-h mr-2"></i>{{__('Products')}}</h5>
|
||||
<h5 class="card-title"><i class="mr-2 fas fa-sliders-h"></i>{{__('Products')}}</h5>
|
||||
<a href="{{route('admin.products.create')}}" class="btn btn-sm btn-primary"><i
|
||||
class="fas fa-plus mr-1"></i>{{__('Create new')}}</a>
|
||||
class="mr-1 fas fa-plus"></i>{{__('Create new')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- CONTENT HEADER -->
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="mb-2 row">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{ __('Servers') }}</h1>
|
||||
</div>
|
||||
|
@ -28,10 +28,10 @@
|
|||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="card-title ">
|
||||
<span><i class="fas fa-server mr-2"></i>{{ __('Servers') }}</span>
|
||||
<span><i class="mr-2 fas fa-server"></i>{{ __('Servers') }}</span>
|
||||
</div>
|
||||
<a href="{{ route('admin.servers.sync') }}" class="btn btn-primary btn-sm"><i
|
||||
class="fas fa-sync mr-2"></i>{{ __('Sync') }}</a>
|
||||
class="mr-2 fas fa-sync"></i>{{ __('Sync') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body table-responsive">
|
||||
|
@ -93,7 +93,6 @@
|
|||
},
|
||||
{
|
||||
data: 'product.name',
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
data: 'suspended'
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- CONTENT HEADER -->
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="mb-2 row">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{ __('Ticket Blacklist') }}</h1>
|
||||
</div>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h5 class="card-title"><i class="fas fas fa-users mr-2"></i>{{__('Blacklist List')}}</h5>
|
||||
<h5 class="card-title"><i class="mr-2 fas fa-users"></i>{{__('Blacklist List')}}</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body table-responsive">
|
||||
|
@ -62,7 +62,7 @@
|
|||
<div class="card-body">
|
||||
<form action="{{route('admin.ticket.blacklist.add')}}" method="POST" class="ticket-form">
|
||||
@csrf
|
||||
<div class="custom-control mb-3 p-0">
|
||||
<div class="p-0 mb-3 custom-control">
|
||||
<label for="user_id">{{ __('User') }}:
|
||||
<i data-toggle="popover" data-trigger="hover"
|
||||
data-content="{{ __('Please note, the blacklist will make the user unable to make a ticket/reply again') }}" class="fas fa-info-circle"></i>
|
||||
|
@ -100,7 +100,7 @@
|
|||
{data: 'user' , name : 'user.name'},
|
||||
{data: 'status'},
|
||||
{data: 'reason'},
|
||||
{data: 'created_at', sortable: false},
|
||||
{data: 'created_at'},
|
||||
{data: 'actions', sortable: false},
|
||||
],
|
||||
fnDrawCallback: function( oSettings ) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- CONTENT HEADER -->
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="mb-2 row">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{__('Ticket')}}</h1>
|
||||
</div>
|
||||
|
@ -28,9 +28,9 @@
|
|||
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h5 class="card-title"><i class="fas fa-ticket-alt mr-2"></i>{{__('Ticket List')}}</h5>
|
||||
<h5 class="card-title"><i class="mr-2 fas fa-ticket-alt"></i>{{__('Ticket List')}}</h5>
|
||||
</div>
|
||||
<a href="{{route("admin.ticket.category.index")}}"><button class="btn btn-primary float-right">+ {{__("Add Category")}}</button></a>
|
||||
<a href="{{route("admin.ticket.category.index")}}"><button class="float-right btn btn-primary">+ {{__("Add Category")}}</button></a>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- CONTENT HEADER -->
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="mb-2 row">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{__('Vouchers')}}</h1>
|
||||
</div>
|
||||
|
@ -28,9 +28,9 @@
|
|||
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h5 class="card-title"><i class="fas fa-money-check-alt mr-2"></i>{{__('Vouchers')}}</h5>
|
||||
<h5 class="card-title"><i class="mr-2 fas fa-money-check-alt"></i>{{__('Vouchers')}}</h5>
|
||||
<a href="{{route('admin.vouchers.create')}}" class="btn btn-sm btn-primary"><i
|
||||
class="fas fa-plus mr-1"></i>{{__('Create new')}}</a>
|
||||
class="mr-1 fas fa-plus"></i>{{__('Create new')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
|||
{data: 'code'},
|
||||
{data: 'memo'},
|
||||
{data: 'credits'},
|
||||
{data: 'uses'},
|
||||
{data: 'uses', sortable: false},
|
||||
{data: 'expires_at'},
|
||||
{data: 'actions', sortable: false},
|
||||
],
|
||||
|
|
95
transferusers.php
Normal file
95
transferusers.php
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* ---------CONFIG----------
|
||||
*
|
||||
* FILL IN THE DATABASE INFORMATION
|
||||
*/
|
||||
|
||||
function generateRandomString($length = 8) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
|
||||
echo "ENTER YOUR PTERODACTYL DATABASE HOST: ";
|
||||
$PTERODACTYL_HOST = trim(fgets(STDIN));
|
||||
echo "ENTER YOUR PTERODACTYL DATABASE USER: ";
|
||||
$PTERODACTYL_USER = trim(fgets(STDIN));
|
||||
echo "ENTER YOUR PTERODACTYL DATABASE PASSWORD: ";
|
||||
$PTERODACTYL_PASSWORD = trim(fgets(STDIN));
|
||||
echo "ENTER YOUR PTERODACTYL DATABASE DATABASE NAME: ";
|
||||
$PTERODACTYL_DATABASE = trim(fgets(STDIN));
|
||||
$pterodb = new mysqli($PTERODACTYL_HOST, $PTERODACTYL_USER, $PTERODACTYL_PASSWORD, $PTERODACTYL_DATABASE);
|
||||
if (!$pterodb) {
|
||||
die('Connect Error (' . mysqli_connect_errno() . ') '
|
||||
. mysqli_connect_error());
|
||||
}
|
||||
echo "ENTER YOUR CPGG DATABASE HOST: ";
|
||||
$CPGG_HOST = trim(fgets(STDIN));
|
||||
echo "ENTER YOUR CPGG DATABASE USER: ";
|
||||
$CPGG_USER = trim(fgets(STDIN));
|
||||
echo "ENTER YOUR CPGG DATABASE PASSWORD: ";
|
||||
$CPPPG_PASSWORD = trim(fgets(STDIN));
|
||||
echo "ENTER YOUR CPGG DATABASE DATABASE NAME: ";
|
||||
$CPGG_DATABASE = trim(fgets(STDIN));
|
||||
|
||||
$cpggdb = new mysqli($CPGG_HOST, $CPGG_USER, $CPPPG_PASSWORD, $CPGG_DATABASE);
|
||||
if (!$cpggdb) {
|
||||
die('Connect Error (' . mysqli_connect_errno() . ') '
|
||||
. mysqli_connect_error());
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo "ENTER THE AMOUNT OF CREDITS A USER SHOULD START WITH (default: 250)";
|
||||
$init_credits = trim(fgets(STDIN));
|
||||
if (empty($init_credits)) {
|
||||
$init_credits = 250;
|
||||
}
|
||||
echo "ENTER THE AMOUNT OF SERVERS A USER SHOULD START WITH (default: 2)";
|
||||
$serverlimit = trim(fgets(STDIN));
|
||||
if (empty($serverlimit)) {
|
||||
$serverlimit = 2;
|
||||
}
|
||||
|
||||
|
||||
$userSQL = "SELECT * FROM `users`";
|
||||
$pteroUserResult = mysqli_query($pterodb, $userSQL);
|
||||
$cpggUserResult = mysqli_query($cpggdb, $userSQL);
|
||||
|
||||
while ($pterouser = $pteroUserResult->fetch_assoc()) {
|
||||
$id = $pterouser["id"];
|
||||
$username = $pterouser["username"];
|
||||
$email = $pterouser['email'];
|
||||
$password = $pterouser['password'];
|
||||
$now = date("Y-m-d H:i:s");
|
||||
$role = "member";
|
||||
$referral_code = generateRandomString();
|
||||
try {
|
||||
if ($pterouser["root_admin"]) {
|
||||
$role = "admin";
|
||||
}
|
||||
$checkusersql = mysqli_query($cpggdb, "SELECT * FROM `users` WHERE `email` = '$email'");
|
||||
if (mysqli_num_rows($checkusersql) > 0) {
|
||||
echo "User ".$email." exists. Skipping! \n";
|
||||
} else {
|
||||
|
||||
|
||||
$sql = "INSERT INTO `users` (`id`, `name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `avatar`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`, `ip`, `last_seen`, `discord_verified_at`, `suspended`, `referral_code`) VALUES (NULL, '$username', '$role', '$init_credits', '$serverlimit', '$id', NULL, '$email', NULL, '$password', NULL, '$now', NULL, NULL, NULL, NULL, '0', '$referral_code')";
|
||||
$res = mysqli_query($cpggdb, $sql);
|
||||
echo "User ".$email." created \n";
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "Fail: " . $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
Loading…
Reference in a new issue