Skip to content

Commit a64d075

Browse files
committed
Add services table migration and sample service icons
- Created `services` table migration with necessary fields including title, slug, description, icon, and is_premium. - Added multiple SVG icons representing sample services.
1 parent 4eb5f0a commit a64d075

40 files changed

Lines changed: 854 additions & 81 deletions
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Services;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Models\Service;
7+
use Illuminate\Http\Request;
8+
use Illuminate\Support\Str;
9+
use Inertia\Inertia;
10+
11+
class ServiceController extends Controller
12+
{
13+
/**
14+
* Display a listing of the resource.
15+
*/
16+
public function index()
17+
{
18+
$services = Service::latest()->get();
19+
return Inertia::render('services/index', [
20+
'services' => $services,
21+
]);
22+
}
23+
24+
/**
25+
* Show the form for creating a new resource.
26+
*/
27+
public function create()
28+
{
29+
return Inertia::render('services/create');
30+
}
31+
32+
/**
33+
* Store a newly created resource in storage.
34+
*/
35+
public function store(Request $request)
36+
{
37+
$validated = $request->validate([
38+
'title' => 'required',
39+
'description' => 'required',
40+
'icon' => 'required',
41+
'is_premium' => 'required',
42+
]);
43+
44+
$validated['slug'] = Str::slug($validated['title']);
45+
46+
if($request->hasFile('icon')){
47+
$file = $request->file('icon');
48+
$filename = time().'.'.$file->getClientOriginalExtension();
49+
$file->move('uploads/services/', $filename);
50+
$validated['icon'] = $filename;
51+
}
52+
53+
Service::create($validated);
54+
55+
return redirect()->route('services.index')->with('success', 'Service created successfully.');
56+
}
57+
58+
/**
59+
* Display the specified resource.
60+
*/
61+
public function show(string $id)
62+
{
63+
//
64+
}
65+
66+
/**
67+
* Show the form for editing the specified resource.
68+
*/
69+
public function edit(string $id)
70+
{
71+
//
72+
}
73+
74+
/**
75+
* Update the specified resource in storage.
76+
*/
77+
public function update(Request $request, string $id)
78+
{
79+
//
80+
}
81+
82+
/**
83+
* Remove the specified resource from storage.
84+
*/
85+
public function destroy(string $id)
86+
{
87+
//
88+
}
89+
}

app/Models/Service.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
class Service extends Model
8+
{
9+
protected $fillable = [
10+
'title',
11+
'slug',
12+
'description',
13+
'icon',
14+
'is_premium'
15+
];
16+
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@
5757
],
5858
"dev": [
5959
"Composer\\Config::disableProcessTimeout",
60-
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
60+
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"npm run dev\" --names=server,queue,vite --kill-others"
6161
],
6262
"dev:ssr": [
6363
"npm run build:ssr",
6464
"Composer\\Config::disableProcessTimeout",
65-
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"php artisan inertia:start-ssr\" --names=server,queue,logs,ssr --kill-others"
65+
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan inertia:start-ssr\" --names=server,queue,ssr --kill-others"
6666
],
6767
"test": [
6868
"@php artisan config:clear --ansi",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration {
8+
/**
9+
* Run the migrations.
10+
*/
11+
public function up(): void
12+
{
13+
Schema::create('services', function (Blueprint $table) {
14+
$table->id();
15+
$table->string('title');
16+
$table->string('slug');
17+
$table->string('description');
18+
$table->string('icon')->nullable();
19+
$table->boolean('is_premium')->default(false);
20+
$table->timestamps();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void
28+
{
29+
Schema::dropIfExists('services');
30+
}
31+
};

package-lock.json

Lines changed: 20 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@radix-ui/react-collapsible": "^1.1.3",
3232
"@radix-ui/react-dialog": "^1.1.6",
3333
"@radix-ui/react-dropdown-menu": "^2.1.6",
34-
"@radix-ui/react-label": "^2.1.2",
34+
"@radix-ui/react-label": "^2.1.7",
3535
"@radix-ui/react-navigation-menu": "^1.2.5",
3636
"@radix-ui/react-select": "^2.1.6",
3737
"@radix-ui/react-separator": "^1.1.2",

public/assets/images/avatar.png

6.74 KB
Loading
Lines changed: 8 additions & 0 deletions
Loading

public/assets/images/favicon.png

6.95 KB
Loading
Lines changed: 16 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)