Skip to content

Commit 623b416

Browse files
committed
added core
1 parent 33050ac commit 623b416

File tree

1,307 files changed

+213308
-306001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,307 files changed

+213308
-306001
lines changed

.gitattributes

Lines changed: 0 additions & 11 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ to attach them to the start of each source file to most effectively
290290
convey the exclusion of warranty; and each file should have at least
291291
the "copyright" line and a pointer to where the full notice is found.
292292

293-
Qaravel
293+
ProFit28
294294
Copyright (C) 2020 Web Developer & Designer
295295

296296
This program is free software; you can redistribute it and/or modify

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Qaravel (qaravel)
1+
# ProFit28 (profit28)
22

3-
Qaravel is a Combination of Laravel and Quasar
3+
Pro-FIT28 | Fitness & Wellbeing Centre | Farsley, Leeds, LS28 5LY
44

55
## 1. Add FontAwesome pro key
66

@@ -29,8 +29,8 @@ allowed to perform. Please check laravel default
2929
[sanctum configuration](https://laravel.com/docs/9.x/sanctum#spa-authentication)
3030

3131
```bash
32-
SANCTUM_STATEFUL_DOMAINS=qaravel.gomedia:9000 (for local you have to include your port)
33-
SESSION_DOMAIN=.qaravel.gomedia
32+
SANCTUM_STATEFUL_DOMAINS=profit28.gomedia:9000 (for local you have to include your port)
33+
SESSION_DOMAIN=.profit28.gomedia
3434
```
3535

3636
## 5. Migrate the Database
@@ -41,7 +41,7 @@ Add your database details on .env
4141
DB_CONNECTION=mysql
4242
DB_HOST=127.0.0.1
4343
DB_PORT=3306
44-
DB_DATABASE=qaravel
44+
DB_DATABASE=profit28
4545
DB_USERNAME=root
4646
DB_PASSWORD=toor
4747
```
@@ -61,22 +61,22 @@ c:\windows\system32\drivers\etc\hosts
6161
Then add thoes line at the bottom and save as admin.
6262

6363
```
64-
127.0.0.1 api.qaravel.gomedia
65-
127.0.0.1 app.qaravel.gomedia
64+
127.0.0.1 api.profit28.gomedia
65+
127.0.0.1 app.profit28.gomedia
6666
```
6767

6868
### 7. Start the app in development mode (hot-code reloading, error reporting, etc.)
6969

7070
> Only for windows user
7171
7272
```
73-
php artisan serve --host=api.qaravel.gomedia --port=80
73+
php artisan serve --host=api.profit28.gomedia --port=80
7474
```
7575

7676
Change your api url from .env.frontend.dev
7777

7878
```
79-
API_URL=http://api.qaravel.gomedia
79+
API_URL=http://api.profit28.gomedia
8080
```
8181

8282
```bash
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Models\User;
6+
use Illuminate\Console\Command;
7+
8+
class CheckBlockUser extends Command
9+
{
10+
/**
11+
* The name and signature of the console command.
12+
*
13+
* @var string
14+
*/
15+
protected $signature = 'check:block-user';
16+
17+
/**
18+
* The console command description.
19+
*
20+
* @var string
21+
*/
22+
protected $description = 'Check block users';
23+
24+
/**
25+
* Execute the console command.
26+
*
27+
* @return int
28+
*/
29+
public function handle()
30+
{
31+
User::whereHas('bookings', function ($q) {
32+
$q->whereNull('canceled_at')
33+
->where('attendence', 0)
34+
->whereHas('schedule', function ($q) {
35+
$q->havingRaw("date_at = CURDATE()")
36+
->whereNotNull('sign_off_at');
37+
});
38+
})->each(function ($user) {
39+
if ($user->blocked && !$user->blocked->isActive() || !$user->blocked) {
40+
$blocked = $user->updateOrCreateBlocked();
41+
$this->info("User #{$user->id} has blocked until {$blocked->release_at}!");
42+
} else {
43+
$this->info("User #{$user->id} already blocked until {$user->blocked->release_at}!");
44+
}
45+
});
46+
}
47+
}

app/Console/Kernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Kernel extends ConsoleKernel
2424
*/
2525
protected function schedule(Schedule $schedule)
2626
{
27-
// $schedule->command('inspire')->hourly();
27+
$schedule->command('check:block-user')->everyMinute();
2828
}
2929

3030
/**
@@ -34,7 +34,7 @@ protected function schedule(Schedule $schedule)
3434
*/
3535
protected function commands()
3636
{
37-
$this->load(__DIR__.'/Commands');
37+
$this->load(__DIR__ . '/Commands');
3838

3939
require base_path('routes/console.php');
4040
}

app/Enum/DayEnum.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace App\Enum;
4+
5+
enum DayEnum: string
6+
{
7+
case MONDAY = 'Monday';
8+
case TUESDAY = 'Tuesday';
9+
case WEDNESDAY = 'Wednesday';
10+
case THURSDAY = 'Thursday';
11+
case FRIDAY = 'Friday';
12+
case SATURDAY = 'Saturday';
13+
case SUNDAY = 'Sunday';
14+
}

app/Enum/StatusEnum.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace App\Enum;
4+
5+
enum StatusEnum: string
6+
{
7+
case ACTIVE = 'Active';
8+
case DEACTIVE = 'Deactive';
9+
case HOLD = 'Hold';
10+
case LOST = 'Lost';
11+
case PENDING = 'Pending';
12+
case ERROR = 'Error';
13+
case REPLIED = 'Replied';
14+
case STAFF_REPLIED = 'Staff Replied';
15+
case COMPLETED = 'Completed';
16+
case ONGOING = 'Ongoing';
17+
case RESOLVED = 'Resolved';
18+
}

app/Events/EnquiryCreated.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
use App\Models\Core\Enquiry;
6+
use Illuminate\Broadcasting\Channel;
7+
use Illuminate\Queue\SerializesModels;
8+
use Illuminate\Broadcasting\PrivateChannel;
9+
use Illuminate\Broadcasting\PresenceChannel;
10+
use Illuminate\Foundation\Events\Dispatchable;
11+
use Illuminate\Broadcasting\InteractsWithSockets;
12+
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
13+
14+
class EnquiryCreated
15+
{
16+
use Dispatchable, InteractsWithSockets, SerializesModels;
17+
18+
public $enquiry;
19+
20+
/**
21+
* Create a new event instance.
22+
*
23+
* @return void
24+
*/
25+
public function __construct(Enquiry $enquiry)
26+
{
27+
$this->enquiry = $enquiry;
28+
}
29+
30+
/**
31+
* Get the channels the event should broadcast on.
32+
*
33+
* @return \Illuminate\Broadcasting\Channel|array
34+
*/
35+
public function broadcastOn()
36+
{
37+
return new PrivateChannel('channel-name');
38+
}
39+
}

app/Events/UserStatusUpdated.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
use App\Enum\StatusEnum;
6+
use App\Models\User;
7+
use Illuminate\Broadcasting\Channel;
8+
use Illuminate\Queue\SerializesModels;
9+
use Illuminate\Broadcasting\PrivateChannel;
10+
use Illuminate\Broadcasting\PresenceChannel;
11+
use Illuminate\Foundation\Events\Dispatchable;
12+
use Illuminate\Broadcasting\InteractsWithSockets;
13+
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
14+
15+
class UserStatusUpdated
16+
{
17+
use Dispatchable, InteractsWithSockets, SerializesModels;
18+
19+
public $user;
20+
public $status;
21+
22+
/**
23+
* Create a new event instance.
24+
*
25+
* @return void
26+
*/
27+
public function __construct(User $user, StatusEnum $status)
28+
{
29+
$this->user = $user;
30+
$this->status = $status->value;
31+
}
32+
33+
/**
34+
* Get the channels the event should broadcast on.
35+
*
36+
* @return \Illuminate\Broadcasting\Channel|array
37+
*/
38+
public function broadcastOn()
39+
{
40+
return new PrivateChannel('channel-name');
41+
}
42+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin;
4+
5+
use App\Models\Announcement;
6+
use Illuminate\Http\Request;
7+
use App\Http\Controllers\Controller;
8+
use Illuminate\Http\Resources\Json\ResourceCollection;
9+
10+
class AnnouncementController extends Controller
11+
{
12+
/**
13+
* Create the controller instance.
14+
*
15+
* @return void
16+
*/
17+
public function __construct()
18+
{
19+
$this->authorizeResource(Announcement::class);
20+
}
21+
22+
/**
23+
* Display a listing of the resource.
24+
*
25+
* @return \Illuminate\Http\Response
26+
*/
27+
public function index(Request $request, Announcement $announcement)
28+
{
29+
$announcement = $announcement->query();
30+
31+
if ($request->filled('filter')) {
32+
$announcement->where('note', 'like', "%{$request->filter}%");
33+
$announcement->orWhere('date', 'like', "%{$request->filter}%");
34+
}
35+
36+
if ($request->boolean('deleted') ?: false) {
37+
$announcement->onlyTrashed();
38+
}
39+
40+
$announcement = $announcement->orderBy(optional($request)->sortBy ?? 'created_at', optional($request)->direction ?? 'desc')
41+
->paginate(optional($request)->rowsPerPage ?? 15);
42+
return new ResourceCollection($announcement);
43+
}
44+
45+
/**
46+
* Store a newly created resource in storage.
47+
*
48+
* @param \Illuminate\Http\Request $request
49+
* @return \Illuminate\Http\Response
50+
*/
51+
public function store(Request $request, Announcement $announcement)
52+
{
53+
$rules = [
54+
'date' => 'required',
55+
'note' => 'required',
56+
];
57+
58+
// Validate those rules
59+
$this->validate($request, $rules);
60+
61+
// create the announcement
62+
$announcement = Announcement::create($request->input());
63+
64+
return response()->json([
65+
'data' => $announcement,
66+
'message' => 'Announcement has been created successfully!',
67+
], 200);
68+
}
69+
70+
/**
71+
* Display the specified resource.
72+
*
73+
* @param \App\Models\Announcement $announcement
74+
* @return \Illuminate\Http\Response
75+
*/
76+
public function show(Announcement $announcement)
77+
{
78+
return response()->json($announcement, 200);
79+
}
80+
81+
/**
82+
* Update the specified resource in storage.
83+
*
84+
* @param \Illuminate\Http\Request $request
85+
* @param \App\Models\Announcement $announcement
86+
* @return \Illuminate\Http\Response
87+
*/
88+
public function update(Request $request, Announcement $announcement)
89+
{
90+
91+
$rules = [
92+
'date' => 'required',
93+
'note' => 'required',
94+
];
95+
96+
// Validate those rules
97+
$this->validate($request, $rules);
98+
99+
// update the announcement
100+
$announcement->update($request->input());
101+
102+
return response()->json([
103+
'data' => $announcement->fresh(),
104+
'message' => 'Announcement has been update successfully!',
105+
], 200);
106+
}
107+
108+
/**
109+
* Remove the specified resource from storage.
110+
*
111+
* @param \App\Models\Announcement $announcement
112+
* @return \Illuminate\Http\Response
113+
*/
114+
public function destroy(Announcement $announcement)
115+
{
116+
$announcement->delete();
117+
return response()->json([
118+
'message' => 'Announcement has been deleted successfully!',
119+
], 200);
120+
}
121+
}

0 commit comments

Comments
 (0)