-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClientController.php
More file actions
46 lines (38 loc) · 1.46 KB
/
ClientController.php
File metadata and controls
46 lines (38 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace App\Http\Controllers\Client;
use App\Http\Controllers\Controller;
use App\Services\Client\ClientService;
use App\Http\Requests\Client\EditProfileRequest;
class ClientController extends Controller
{
public function generateReport($id)
{
try {
if (!$id) {
return $this->messageResponse(false, "Route ID not provided", 400, null);
}
$report = ClientService::generateReport($id);
return $this->messageResponse(true, "Report Generated", 200, $report);
} catch (\Exception $e) {
return $this->errorMessageResponse(false, "Failed to generate report ", $e->getMessage(), 500);
}
}
public function editProfile(EditProfileRequest $request)
{
try {
ClientService::editProfile($request->validated());
return $this->messageResponse(true, "Profile updated successfully", 200);
} catch (\Exception $e) {
return $this->errorMessageResponse(false, $e->getMessage(), "Failed to update profile", 500);
}
}
public function getDashboardData($id)
{
try {
$dashboardData = ClientService::getDashboardData($id);
return $this->messageResponse(true, "Dashboard data fetched successfully", 200, $dashboardData);
} catch (\Exception $e) {
return $this->errorMessageResponse(false, "Failed to fetch dashboard data", $e->getMessage(), 500);
}
}
}