Skip to content

Commit 3526a8c

Browse files
committed
Initial Support Ticket work
1 parent 50d33de commit 3526a8c

File tree

6 files changed

+212
-3
lines changed

6 files changed

+212
-3
lines changed

app/Models/SupportTicket.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8+
use Illuminate\Database\Eloquent\SoftDeletes;
9+
10+
class SupportTicket extends Model
11+
{
12+
use HasFactory, SoftDeletes;
13+
14+
protected $fillable = [
15+
'user_id',
16+
'mask',
17+
'subject',
18+
'message',
19+
'status',
20+
];
21+
22+
public function user(): BelongsTo
23+
{
24+
return $this->belongsTo(User::class);
25+
}
26+
}

app/Models/User.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// use Illuminate\Contracts\Auth\MustVerifyEmail;
66
use Illuminate\Database\Eloquent\Factories\HasFactory;
7+
use Illuminate\Database\Eloquent\Relations\HasMany;
78
use Illuminate\Foundation\Auth\User as Authenticatable;
89
use Illuminate\Notifications\Notifiable;
910
use Laravel\Cashier\Billable;
@@ -24,4 +25,9 @@ class User extends Authenticatable
2425
'email_verified_at' => 'datetime',
2526
'password' => 'hashed',
2627
];
28+
29+
public function supportTickets(): HasMany
30+
{
31+
return $this->hasMany(SupportTicket::class);
32+
}
2733
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Database\Factories;
4+
5+
use App\Models\SupportTicket;
6+
use App\Models\User;
7+
use Illuminate\Database\Eloquent\Factories\Factory;
8+
use Illuminate\Support\Carbon;
9+
10+
class SupportTicketFactory extends Factory
11+
{
12+
protected $model = SupportTicket::class;
13+
14+
public function definition(): array
15+
{
16+
return [
17+
'mask' => $this->faker->word(),
18+
'subject' => $this->faker->word(),
19+
'message' => $this->faker->word(),
20+
'status' => $this->faker->word(),
21+
'created_at' => Carbon::now(),
22+
'updated_at' => Carbon::now(),
23+
24+
'user_id' => User::factory(),
25+
];
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
use App\Models\User;
4+
use Illuminate\Database\Migrations\Migration;
5+
use Illuminate\Database\Schema\Blueprint;
6+
use Illuminate\Support\Facades\Schema;
7+
8+
return new class extends Migration {
9+
public function up(): void
10+
{
11+
Schema::create('support_tickets', function (Blueprint $table) {
12+
$table->id();
13+
$table->foreignIdFor(User::class);
14+
$table->string('mask');
15+
$table->string('subject');
16+
$table->text('message');
17+
$table->string('status');
18+
$table->timestamps();
19+
$table->softDeletes();
20+
});
21+
}
22+
23+
public function down(): void
24+
{
25+
Schema::dropIfExists('support_tickets');
26+
}
27+
};

resources/views/account/index.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<header class="mb-10 text-center">
66
<h1 class="text-4xl font-bold md:text-5xl dark:text-white/90">Account</h1>
77
<p class="mx-auto mt-4 max-w-2xl text-lg text-gray-600 dark:text-white/60">
8-
Manage your NativePHP Account
8+
Manage your NativePHP Account.<br />
9+
Not {{ auth()->user()->name }}? <a href="{{ route('logout') }}" class="text-violet-600 hover:text-violet-700 dark:text-violet-400 dark:hover:text-violet-300">Logout</a>.
910
</p>
1011
</header>
1112

@@ -25,8 +26,7 @@ class="group flex w-full flex-col items-center rounded-xl bg-gray-100/80 p-8 tex
2526
<p class="mt-2 text-gray-600 dark:text-gray-400">View your license(s)</p>
2627
</a>
2728

28-
{{-- Discord Box --}}
29-
<a href="#"
29+
<a href="{{ route('support.tickets') }}"
3030
target="_blank"
3131
rel="noopener"
3232
class="group flex w-full flex-col items-center rounded-xl bg-gray-100/80 p-8 text-center transition duration-300 hover:-translate-y-1 hover:bg-gray-200/80 hover:shadow-lg dark:bg-gray-800/50 dark:hover:bg-gray-700/50 dark:hover:shadow-gray-900/30"
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<x-layout title="Tickets - NativePHP">
2+
{{-- Support Grid Section --}}
3+
<section class="mx-auto mt-10 max-w-5xl px-5 md:mt-14">
4+
{{-- Header --}}
5+
<header class="mb-10 text-center">
6+
<h1 class="text-4xl font-bold md:text-5xl dark:text-white/90">Support Tickets</h1>
7+
<p class="mx-auto mt-4 max-w-2xl text-lg text-gray-600 dark:text-white/60">
8+
Manage your support tickets.<br />
9+
</p>
10+
</header>
11+
12+
{{-- Support ticket table --}}
13+
<div class="flex justify-end mb-4">
14+
<a href="#" class="inline-flex items-center rounded-md bg-violet-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
15+
<svg xmlns="http://www.w3.org/2000/svg" class="mr-2 h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
16+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
17+
</svg>
18+
Submit a new request
19+
</a>
20+
</div>
21+
<div class="overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-700 mb-10">
22+
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
23+
<thead class="bg-gray-50 dark:bg-gray-800">
24+
<tr>
25+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">
26+
Ticket ID
27+
</th>
28+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">
29+
Subject
30+
</th>
31+
<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">
32+
Status
33+
</th>
34+
<th scope="col" class="px-6 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">
35+
Actions
36+
</th>
37+
</tr>
38+
</thead>
39+
<tbody class="divide-y divide-gray-200 dark:divide-gray-700 bg-white dark:bg-gray-900">
40+
<tr>
41+
<td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
42+
#TKT-1001
43+
</td>
44+
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-700 dark:text-gray-300">
45+
Installation issue on Windows 11
46+
</td>
47+
<td class="whitespace-nowrap px-6 py-4 text-sm">
48+
<span class="inline-flex rounded-full bg-green-100 px-2.5 py-0.5 text-xs font-medium text-green-800 dark:bg-green-900/30 dark:text-green-300">
49+
Open
50+
</span>
51+
</td>
52+
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
53+
<a href="#" class="rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
54+
View
55+
</a>
56+
</td>
57+
</tr>
58+
<tr>
59+
<td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
60+
#TKT-1002
61+
</td>
62+
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-700 dark:text-gray-300">
63+
API integration with third-party service
64+
</td>
65+
<td class="whitespace-nowrap px-6 py-4 text-sm">
66+
<span class="inline-flex rounded-full bg-yellow-100 px-2.5 py-0.5 text-xs font-medium text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300">
67+
In Progress
68+
</span>
69+
</td>
70+
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
71+
<a href="#" class="rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
72+
View
73+
</a>
74+
</td>
75+
</tr>
76+
<tr>
77+
<td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
78+
#TKT-1003
79+
</td>
80+
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-700 dark:text-gray-300">
81+
Feature request: dark mode toggle
82+
</td>
83+
<td class="whitespace-nowrap px-6 py-4 text-sm">
84+
<span class="inline-flex rounded-full bg-blue-100 px-2.5 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/30 dark:text-blue-300">
85+
Responded
86+
</span>
87+
</td>
88+
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
89+
<a href="#" class="rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
90+
View
91+
</a>
92+
</td>
93+
</tr>
94+
<tr>
95+
<td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
96+
#TKT-1004
97+
</td>
98+
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-700 dark:text-gray-300">
99+
Database migration error
100+
</td>
101+
<td class="whitespace-nowrap px-6 py-4 text-sm">
102+
<span class="inline-flex rounded-full bg-gray-100 px-2.5 py-0.5 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-300">
103+
Closed
104+
</span>
105+
</td>
106+
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
107+
<a href="#" class="rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
108+
View
109+
</a>
110+
</td>
111+
</tr>
112+
</tbody>
113+
</table>
114+
</div>
115+
{{-- Additional Support Information --}}
116+
<div class="mt-20 rounded-xl bg-gradient-to-br from-[#FFF0DC] to-[#E8EEFF] p-8 dark:from-blue-900/10 dark:to-[#4c407f]/25">
117+
<h2 class="mb-4 text-2xl font-medium">Need more help?</h2>
118+
<p class="text-lg text-gray-700 dark:text-gray-300">
119+
Check out our <a href="/docs" class="font-medium text-violet-600 hover:text-violet-700 dark:text-violet-400 dark:hover:text-violet-300">documentation</a> for comprehensive guides and tutorials to help you get the most out of NativePHP.
120+
</p>
121+
</div>
122+
</section>
123+
</x-layout>

0 commit comments

Comments
 (0)