Skip to content

fix:[lar-146] undefined name fix after payement #270

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

Merged
merged 2 commits into from
Dec 25, 2024
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
4 changes: 3 additions & 1 deletion app/Livewire/Components/SponsorSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public function submit(): void

$email = data_get($this->form->getState(), 'email');
$amount = data_get($this->form->getState(), 'amount');
$name = data_get($this->form->getState(), 'name');

/** @var User $user */
$user = Auth::check() ? Auth::user() : User::findByEmailAddress(config('lcm.support_email'));
Expand All @@ -121,7 +122,7 @@ public function submit(): void
$payload = Payment::initialize([
'amount' => $amount,
'email' => $email,
'name' => data_get($this->form->getState(), 'name'),
'name' => $name,
'currency' => data_get($this->form->getState(), 'currency'),
'reference' => $user->id.'-'.$user->username().'-'.uniqid(),
'callback' => route('notchpay-callback'),
Expand All @@ -141,6 +142,7 @@ public function submit(): void
'merchant' => [
'reference' => $payload->transaction->merchant_reference,
'customer' => $payload->transaction->customer,
'name' => $name,
'laravel_cm_id' => Auth::id() ?? null,
'profile' => data_get($this->form->getState(), 'profile'),
],
Expand Down
2 changes: 1 addition & 1 deletion lang/fr/pages/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'latest_of' => 'Dernières activités de :name',
'empty' => 'Aucune activité pour le moment.',
'empty_articles' => "n'a pas encore rédigé d'articles",
'empty_discussions' => "n'a pas encore démarrer de discussions",
'empty_discussions' => "n'a pas encore démarré de discussions",
'empty_threads' => "n'a pas encore posté de sujets",
],

Expand Down
47 changes: 24 additions & 23 deletions resources/views/components/sponsor-profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,41 @@
'sponsor',
])

@php
$isUser = data_get($sponsor->getMetadata('merchant'), 'laravel_cm_id')
@endphp

<div x-data id="{{ $sponsor->id }}">
<template x-ref="template">
<div class="w-full max-w-xs rounded-md bg-skin-card px-4 py-2">
<div class="w-full max-w-xs px-3 py-2">
<div class="flex items-center space-x-2">
@if ($sponsor->getMetadata('merchant')['laravel_cm_id'])
<img
class="size-8 rounded-full object-cover"
src="{{ $sponsor->user->profile_photo_url }}"
alt=""
/>
@if ($isUser)
<x-user.avatar :user="$sponsor->user" class="size-6" />
@else
<svg class="size-8 text-gray-400 dark:text-gray-500" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<svg class="size-6 text-gray-400 dark:text-gray-500" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path
fill-rule="evenodd"
d="M18.685 19.097A9.723 9.723 0 0021.75 12c0-5.385-4.365-9.75-9.75-9.75S2.25 6.615 2.25 12a9.723 9.723 0 003.065 7.097A9.716 9.716 0 0012 21.75a9.716 9.716 0 006.685-2.653zm-12.54-1.285A7.486 7.486 0 0112 15a7.486 7.486 0 015.855 2.812A8.224 8.224 0 0112 20.25a8.224 8.224 0 01-5.855-2.438zM15.75 9a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z"
clip-rule="evenodd"
/>
</svg>
@endif
<div class="flex items-center text-sm leading-5 text-gray-500 dark:text-gray-400">
@if ($sponsor->getMetadata('merchant')['laravel_cm_id'])
<span>{{ $sponsor->user->username }}</span>
<span class="ml-1 font-medium text-gray-700 dark:text-gray-300">{{ $sponsor->user->name }}</span>
@else
<span>{{ $sponsor->getMetadata('merchant')['name'] }}</span>

<div class="flex items-center text-xs/5 text-gray-400">
@if ($isUser)
<span>{{ $sponsor->user->username }} -</span>
<span class="ml-1 font-medium text-gray-300">{{ $sponsor->user->name }}</span>
@endif

@if(!$isUser && data_get($sponsor->getMetadata('merchant'), 'name'))
<span>{{ $sponsor->getMetadata('merchant')['name'] }}</span>
@endisset
</div>
</div>
@if ($sponsor->getMetadata('merchant')['laravel_cm_id'])
<p class="line-clamp-3 text-sm leading-5 text-gray-500 dark:text-gray-400">{{ $sponsor->user->bio ?? ' ' }}</p>
@if ($isUser)
<p class="line-clamp-2 text-xs/5 text-white">
{{ $sponsor->user->bio ? \Illuminate\Support\Str::limit($sponsor->user->bio, 50) : '' }}
</p>
@endif
</div>
</template>
Expand All @@ -42,14 +47,10 @@ class="size-8 rounded-full object-cover"
appendTo: $root,
}"
class="relative inline-flex items-center"
href="{{ $sponsor->getMetadata('merchant')['laravel_cm_id'] ? route('profile', ['username' => $sponsor->user->username]) : '#' }}"
href="{{ $isUser ? route('profile', $sponsor->user) : '#' }}"
>
@if ($sponsor->getMetadata('merchant')['laravel_cm_id'])
<img
class="mx-auto size-8 rounded-full object-cover"
src="{{ $sponsor->user->profile_photo_url }}"
alt=""
/>
@if ($isUser)
<x-user.avatar :user="$sponsor->user" class="size-8" />
@else
<span class="flex size-10 items-center">
<svg class="h-full w-full text-gray-400 dark:text-gray-500" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
Expand Down
8 changes: 4 additions & 4 deletions resources/views/livewire/pages/account/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,24 @@ class="size-24 !ring-4 ring-white dark:ring-gray-800 lg:size-32"
</time>
</p>

@isset($user->location)
@if ($user->location)
<div class="mt-1 text-sm flex items-center gap-2">
<h5 class="sr-only">{{ __('pages/account.account.location') }}</h5>
<x-untitledui-marker-pin-02 class="size-4 text-gray-400 dark:text-gray-500" aria-hidden="true" />
<p class="text-gray-500 dark:text-gray-400">
{{ $user->location }}
</p>
</div>
@endisset
@endif

@isset($user->bio)
@if ($user->bio)
<div class="mt-4">
<h5 class="sr-only">{{ __('pages/account.account.biography') }}</h5>
<p class="text-sm text-gray-600 max-w-lg dark:text-gray-300">
{{ $user->bio }}
</p>
</div>
@endisset
@endif

@if ($user->githubUsername() || $user->twitter() || $user->linkedin() || $user->website)
<div class="mt-5 flex items-center gap-4">
Expand Down
8 changes: 0 additions & 8 deletions routes/features/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@

declare(strict_types=1);

use App\Http\Controllers\User;
use App\Livewire\Pages\Account;
use Illuminate\Support\Facades\Route;

// Settings
/*Route::prefix('settings')->as('user.')->middleware(['auth', 'checkIfBanned'])->group(function (): void {
Route::put('/', [User\SettingController::class, 'update'])->name('settings.update');
Route::view('/customization', 'user.settings.customization')->name('customization')->middleware('verified');
Route::view('/notifications', 'user.settings.notifications')->name('notifications')->middleware('verified');
});*/

Route::middleware(['auth', 'checkIfBanned', 'verified'])->group(function (): void {
Route::get('/settings', Account\Settings::class)->name('settings');
Route::get('/dashboard', Account\Dashboard::class)->name('dashboard');
Expand Down
Loading