Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #806

Merged
merged 4 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/Console/Commands/MakeUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ public function handle(PterodactylSettings $ptero_settings)
['Referral code', $user->referral_code],
]);

$user->syncRoles(1);

return 1;
}
}
4 changes: 2 additions & 2 deletions app/Helpers/ExtensionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function getAllExtensionClasses()

// replace all slashes with backslashes
$extensions = array_map(fn ($item) => str_replace('/', '\\', $item), $extensions);
// add the ExtensionClass to the end of the namespace
// add the ExtensionClass to the end of the namespace
$extensions = array_map(fn ($item) => $item . '\\' . basename($item) . 'Extension', $extensions);
// filter out non existing extension classes
$extensions = array_filter($extensions, fn ($item) => class_exists($item));
Expand Down Expand Up @@ -104,7 +104,7 @@ public static function getExtensionClass(string $extensionName)
if (!(basename($extension) == $extensionName)) {
continue;
}

$extension = str_replace('/', '\\', $extension);
$extensionClass = $extension . '\\' . $extensionName . 'Extension';
return $extensionClass;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/isMod.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class isMod
*/
public function handle(Request $request, Closure $next)
{
if (Auth::user() && Auth::user()->role == 'moderator' || Auth::user() && Auth::user()->hasRole("Admin")) {
if (Auth::user() && Auth::user()->role == 'moderator' || Auth::user() && Auth::user()->hasRole(1)) {
return $next($request);
}

Expand Down
6 changes: 3 additions & 3 deletions app/Listeners/UserPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(UserSettings $user_settings, ReferralSettings $refer
$this->referral_always_give_commission = $referral_settings->always_give_commission;
$this->credits_display_name = $general_settings->credits_display_name;
}

/**
* Handle the event.
*
Expand Down Expand Up @@ -79,8 +79,8 @@ public function handle(PaymentEvent $event)
}
}
//update role give Referral-reward
if ($user->role == 'member') {
$user->update(['role' => 'client']);
if ($user->hasRole(4)) {
$user->syncRoles(3);

//give referral commission only on first purchase
if (($this->referral_mode === "commission" || $this->referral_mode === "both") && $shopProduct->type == "Credits" && !$this->referral_always_give_commission) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function up(): void
$this->migrator->add('invoice.company_phone', $table_exists ? $this->getOldValue('SETTINGS::INVOICE:COMPANY_PHONE') : '');
$this->migrator->add('invoice.company_vat', $table_exists ? $this->getOldValue('SETTINGS::INVOICE:COMPANY_VAT') : '');
$this->migrator->add('invoice.company_website', $table_exists ? $this->getOldValue('SETTINGS::INVOICE:COMPANY_WEBSITE') : '');
$this->migrator->add('invoice.enabled', $table_exists ? $this->getOldValue('SETTINGS::INVOICE:ENABLED') : true);
$this->migrator->add('invoice.enabled', $table_exists ? $this->getOldValue('SETTINGS::INVOICE:ENABLED') : false);
$this->migrator->add('invoice.prefix', $table_exists ? $this->getOldValue('SETTINGS::INVOICE:PREFIX') : 'INV');
}

Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
Route::post('ticket/new', [TicketsController::class, 'store'])->middleware(['throttle:ticket-new'])->name('ticket.new.store');
Route::get('ticket/show/{ticket_id}', [TicketsController::class, 'show'])->name('ticket.show');
Route::post('ticket/reply', [TicketsController::class, 'reply'])->middleware(['throttle:ticket-reply'])->name('ticket.reply');
Route::post('ticket/close/{ticket_id}', [TicketsController::class, 'close'])->name('ticket.close');
Route::post('ticket/status/{ticket_id}', [TicketsController::class, 'changeStatus'])->name('ticket.changeStatus');


//admin
Expand Down
15 changes: 3 additions & 12 deletions themes/default/views/admin/users/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,9 @@
<label>{{ __('Role') }}</label>
</div>
<div class="col-lg-8">
<span style="max-width: 250px;"
class="d-inline-block text-truncate badge
@if ($user->hasRole("Admin")) badge-danger
@elseif ($user->role == 'moderator')
badge-info
@elseif ($user->role == 'client')
badge-success
@else
badge-secondary @endif
">
{{ $user->role }}
</span>
@foreach ($user->roles as $role)
<span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@endforeach
</div>
</div>
</div>
Expand Down
24 changes: 6 additions & 18 deletions themes/default/views/moderator/ticket/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,9 @@ class="fas fa-times"></i>{{__("Close")}}</button>
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticket->user->email)) }}?s=25"
class="user-image" alt="User Image">
<a href="/admin/users/{{$ticket->user->id}}">{{ $ticket->user->name }}</a>
@if($ticket->user->role === "member")
<span class="badge badge-secondary"> Member </span>
@elseif ($ticket->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticket->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticket->user->hasRole("Admin"))
<span class="badge badge-danger"> Admin </span>
@endif
@foreach ($ticket->user->roles as $role)
<span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@endforeach
</h5>
<span class="badge badge-primary">{{ $ticket->created_at->diffForHumans() }}</span>
</div>
Expand All @@ -135,15 +129,9 @@ class="user-image" alt="User Image">
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticketcomment->user->email)) }}?s=25"
class="user-image" alt="User Image">
<a href="/admin/users/{{$ticketcomment->user->id}}">{{ $ticketcomment->user->name }}</a>
@if($ticketcomment->user->role === "member")
<span class="badge badge-secondary"> Member </span>
@elseif ($ticketcomment->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticketcomment->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticketcomment->user->hasRole("Admin"))
<span class="badge badge-danger"> Admin </span>
@endif
@foreach ($ticketcomment->user->roles as $role)
<span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@endforeach
</h5>
<span class="badge badge-primary">{{ $ticketcomment->created_at->diffForHumans() }}</span>
</div>
Expand Down
24 changes: 6 additions & 18 deletions themes/default/views/ticket/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,9 @@ class="fas fa-times"></i>{{__("Close")}}</button>
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticket->user->email)) }}?s=25"
class="user-image" alt="User Image">
<a href="/admin/users/{{$ticket->user->id}}">{{ $ticket->user->name }} </a>
@if($ticket->user->role === "member")
<span class="badge badge-secondary"> Member </span>
@elseif ($ticket->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticket->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticket->user->hasRole("Admin"))
<span class="badge badge-danger"> Admin </span>
@endif
@foreach ($ticket->user->roles as $role)
<span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@endforeach
</h5>
<span
class="badge badge-primary">{{ $ticket->created_at->diffForHumans() }}</span>
Expand All @@ -136,15 +130,9 @@ class="badge badge-primary">{{ $ticket->created_at->diffForHumans() }}</span>
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticketcomment->user->email)) }}?s=25"
class="user-image" alt="User Image">
<a href="/admin/users/{{$ticketcomment->user->id}}">{{ $ticketcomment->user->name }}</a>
@if($ticketcomment->user->role === "member")
<span class="badge badge-secondary"> Member </span>
@elseif ($ticketcomment->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticketcomment->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticketcomment->user->hasRole("Admin"))
<span class="badge badge-danger"> Admin </span>
@endif
@foreach ($ticketcomment->user->roles as $role)
<span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@endforeach
</h5>
<span
class="badge badge-primary">{{ $ticketcomment->created_at->diffForHumans() }}</span>
Expand Down