disable invoices by default || full frontend roles shown

This commit is contained in:
Dennis 2023-05-03 16:17:31 +02:00 committed by GitHub
commit 88bb1395ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 25 additions and 56 deletions

View file

@ -101,6 +101,8 @@ class MakeUserCommand extends Command
['Referral code', $user->referral_code], ['Referral code', $user->referral_code],
]); ]);
$user->syncRoles(1);
return 1; return 1;
} }
} }

View file

@ -104,7 +104,7 @@ class ExtensionHelper
if (!(basename($extension) == $extensionName)) { if (!(basename($extension) == $extensionName)) {
continue; continue;
} }
$extension = str_replace('/', '\\', $extension);
$extensionClass = $extension . '\\' . $extensionName . 'Extension'; $extensionClass = $extension . '\\' . $extensionName . 'Extension';
return $extensionClass; return $extensionClass;
} }

View file

@ -18,7 +18,7 @@ class isMod
*/ */
public function handle(Request $request, Closure $next) 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); return $next($request);
} }

View file

@ -79,8 +79,8 @@ class UserPayment
} }
} }
//update role give Referral-reward //update role give Referral-reward
if ($user->role == 'member') { if ($user->hasRole(4)) {
$user->update(['role' => 'client']); $user->syncRoles(3);
//give referral commission only on first purchase //give referral commission only on first purchase
if (($this->referral_mode === "commission" || $this->referral_mode === "both") && $shopProduct->type == "Credits" && !$this->referral_always_give_commission) { if (($this->referral_mode === "commission" || $this->referral_mode === "both") && $shopProduct->type == "Credits" && !$this->referral_always_give_commission) {

View file

@ -16,7 +16,7 @@ class CreateInvoiceSettings extends SettingsMigration
$this->migrator->add('invoice.company_phone', $table_exists ? $this->getOldValue('SETTINGS::INVOICE:COMPANY_PHONE') : ''); $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_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.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'); $this->migrator->add('invoice.prefix', $table_exists ? $this->getOldValue('SETTINGS::INVOICE:PREFIX') : 'INV');
} }

View file

@ -113,7 +113,7 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
Route::post('ticket/new', [TicketsController::class, 'store'])->middleware(['throttle:ticket-new'])->name('ticket.new.store'); 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::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/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 //admin

View file

@ -74,18 +74,9 @@
<label>{{ __('Role') }}</label> <label>{{ __('Role') }}</label>
</div> </div>
<div class="col-lg-8"> <div class="col-lg-8">
<span style="max-width: 250px;" @foreach ($user->roles as $role)
class="d-inline-block text-truncate badge <span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@if ($user->hasRole("Admin")) badge-danger @endforeach
@elseif ($user->role == 'moderator')
badge-info
@elseif ($user->role == 'client')
badge-success
@else
badge-secondary @endif
">
{{ $user->role }}
</span>
</div> </div>
</div> </div>
</div> </div>

View file

@ -112,15 +112,9 @@
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticket->user->email)) }}?s=25" src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticket->user->email)) }}?s=25"
class="user-image" alt="User Image"> class="user-image" alt="User Image">
<a href="/admin/users/{{$ticket->user->id}}">{{ $ticket->user->name }}</a> <a href="/admin/users/{{$ticket->user->id}}">{{ $ticket->user->name }}</a>
@if($ticket->user->role === "member") @foreach ($ticket->user->roles as $role)
<span class="badge badge-secondary"> Member </span> <span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@elseif ($ticket->user->role === "client") @endforeach
<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
</h5> </h5>
<span class="badge badge-primary">{{ $ticket->created_at->diffForHumans() }}</span> <span class="badge badge-primary">{{ $ticket->created_at->diffForHumans() }}</span>
</div> </div>
@ -135,15 +129,9 @@
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticketcomment->user->email)) }}?s=25" src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticketcomment->user->email)) }}?s=25"
class="user-image" alt="User Image"> class="user-image" alt="User Image">
<a href="/admin/users/{{$ticketcomment->user->id}}">{{ $ticketcomment->user->name }}</a> <a href="/admin/users/{{$ticketcomment->user->id}}">{{ $ticketcomment->user->name }}</a>
@if($ticketcomment->user->role === "member") @foreach ($ticketcomment->user->roles as $role)
<span class="badge badge-secondary"> Member </span> <span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@elseif ($ticketcomment->user->role === "client") @endforeach
<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
</h5> </h5>
<span class="badge badge-primary">{{ $ticketcomment->created_at->diffForHumans() }}</span> <span class="badge badge-primary">{{ $ticketcomment->created_at->diffForHumans() }}</span>
</div> </div>

View file

@ -112,15 +112,9 @@
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticket->user->email)) }}?s=25" src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticket->user->email)) }}?s=25"
class="user-image" alt="User Image"> class="user-image" alt="User Image">
<a href="/admin/users/{{$ticket->user->id}}">{{ $ticket->user->name }} </a> <a href="/admin/users/{{$ticket->user->id}}">{{ $ticket->user->name }} </a>
@if($ticket->user->role === "member") @foreach ($ticket->user->roles as $role)
<span class="badge badge-secondary"> Member </span> <span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@elseif ($ticket->user->role === "client") @endforeach
<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
</h5> </h5>
<span <span
class="badge badge-primary">{{ $ticket->created_at->diffForHumans() }}</span> class="badge badge-primary">{{ $ticket->created_at->diffForHumans() }}</span>
@ -136,15 +130,9 @@
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticketcomment->user->email)) }}?s=25" src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticketcomment->user->email)) }}?s=25"
class="user-image" alt="User Image"> class="user-image" alt="User Image">
<a href="/admin/users/{{$ticketcomment->user->id}}">{{ $ticketcomment->user->name }}</a> <a href="/admin/users/{{$ticketcomment->user->id}}">{{ $ticketcomment->user->name }}</a>
@if($ticketcomment->user->role === "member") @foreach ($ticketcomment->user->roles as $role)
<span class="badge badge-secondary"> Member </span> <span style='background-color: {{$role->color}}' class='badge'>{{$role->name}}</span>
@elseif ($ticketcomment->user->role === "client") @endforeach
<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
</h5> </h5>
<span <span
class="badge badge-primary">{{ $ticketcomment->created_at->diffForHumans() }}</span> class="badge badge-primary">{{ $ticketcomment->created_at->diffForHumans() }}</span>