Skip to content
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
20 changes: 20 additions & 0 deletions app/Livewire/Customer/WallOfLove/Edit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Livewire\Customer\WallOfLove;

use App\Models\WallOfLoveSubmission;
use Livewire\Attributes\Layout;
use Livewire\Attributes\Title;
use Livewire\Component;

#[Layout('components.layouts.dashboard')]
#[Title('Edit Your Listing')]
class Edit extends Component
{
public WallOfLoveSubmission $wallOfLoveSubmission;

public function mount(WallOfLoveSubmission $wallOfLoveSubmission): void
{
abort_if($wallOfLoveSubmission->user_id !== auth()->id(), 403);
}
}
35 changes: 0 additions & 35 deletions app/Livewire/WallOfLoveBanner.php

This file was deleted.

76 changes: 65 additions & 11 deletions app/Livewire/WallOfLoveSubmissionForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,83 @@ class WallOfLoveSubmissionForm extends Component
{
use WithFileUploads;

public ?WallOfLoveSubmission $submission = null;

public bool $isEditing = false;

public $name = '';

public $company = '';

public $photo;

public ?string $existingPhoto = null;

public $url = '';

public $testimonial = '';

protected $rules = [
'name' => 'required|string|max:255',
'company' => 'nullable|string|max:255',
'photo' => 'nullable|image|max:2048', // 2MB max
'url' => 'nullable|url|max:255',
'testimonial' => 'nullable|string|max:1000',
];
public function mount(?WallOfLoveSubmission $submission = null): void
{
if ($submission && $submission->exists && $submission->user_id === auth()->id()) {
$this->submission = $submission;
$this->isEditing = true;
$this->name = $submission->name;
$this->company = $submission->company ?? '';
$this->existingPhoto = $submission->photo_path;
$this->url = $submission->url ?? '';
$this->testimonial = $submission->testimonial ?? '';
} else {
// Pre-fill name if user has a name
$this->name = auth()->user()->name ?? '';
}
}

public function mount()
public function rules(): array
{
// Pre-fill name if user has a name
$this->name = auth()->user()->name ?? '';
if ($this->isEditing) {
return [
'company' => 'nullable|string|max:255',
'photo' => 'nullable|image|max:2048',
];
}

return [
'name' => 'required|string|max:255',
'company' => 'nullable|string|max:255',
'photo' => 'nullable|image|max:2048',
'url' => 'nullable|url|max:255',
'testimonial' => 'nullable|string|max:1000',
];
}

public function submit()
public function submit(): mixed
{
$this->validate();

if ($this->isEditing && $this->submission) {
$data = [
'company' => $this->company ?: null,
];

if ($this->photo) {
$data['photo_path'] = $this->photo->store('wall-of-love-photos', 'public');
} elseif ($this->existingPhoto === null) {
$data['photo_path'] = null;
}

$this->submission->update($data);

if ($this->photo) {
$this->existingPhoto = $data['photo_path'];
$this->reset('photo');
}

session()->flash('success', 'Your listing has been updated.');

return null;
}

$photoPath = null;
if ($this->photo) {
$photoPath = $this->photo->store('wall-of-love-photos', 'public');
Expand All @@ -55,6 +104,11 @@ public function submit()
return to_route('dashboard')->with('success', 'Thank you! Your submission has been received and is awaiting review.');
}

public function removeExistingPhoto(): void
{
$this->existingPhoto = null;
}

public function render()
{
return view('livewire.wall-of-love-submission-form');
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 0 additions & 62 deletions resources/views/components/dashboard-menu.blade.php

This file was deleted.

11 changes: 11 additions & 0 deletions resources/views/components/layouts/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ class="min-h-screen bg-white font-poppins antialiased dark:bg-zinc-900 dark:text
<flux:sidebar.item href="{{ route('customer.showcase.index') }}" :current="request()->routeIs('customer.showcase.*')">
Showcase
</flux:sidebar.item>
@if(auth()->user()->licenses()->where('created_at', '<', '2025-06-01')->exists())
@php
$wallOfLoveSubmission = auth()->user()->wallOfLoveSubmissions()->first();
$wallOfLoveUrl = $wallOfLoveSubmission
? route('customer.wall-of-love.edit', $wallOfLoveSubmission)
: route('customer.wall-of-love.create');
@endphp
<flux:sidebar.item href="{{ $wallOfLoveUrl }}" :current="request()->routeIs('customer.wall-of-love.*')">
Wall of Love
</flux:sidebar.item>
@endif
<flux:sidebar.item href="https://discord.gg/nativephp" target="_blank">
Discord
</flux:sidebar.item>
Expand Down
Loading
Loading