Merge branch 'dev' into 'main'
feat: Implement local scopes for report statuses in the Report model and... See merge request pratama/purwakarta/diskominfo/simedkom!7
This commit is contained in:
commit
21fe8e1cc1
@ -71,6 +71,8 @@ protected function handleRegistration(array $data): Model
|
|||||||
$user = $this->getUserModel()::create($data);
|
$user = $this->getUserModel()::create($data);
|
||||||
$user->assignRole('Perusahaan');
|
$user->assignRole('Perusahaan');
|
||||||
|
|
||||||
|
$user->sendEmailVerificationNotification();
|
||||||
|
|
||||||
CheerfulNotification::success(
|
CheerfulNotification::success(
|
||||||
'Selamat Datang! 👋🎉',
|
'Selamat Datang! 👋🎉',
|
||||||
"Halooo, {$user->name}!, terima kasih sudah bergabung! Akunmu berhasil dibuat. Silakan verifikasi alamat surelmu! 🚀✨"
|
"Halooo, {$user->name}!, terima kasih sudah bergabung! Akunmu berhasil dibuat. Silakan verifikasi alamat surelmu! 🚀✨"
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Filament\Widgets;
|
namespace App\Filament\Widgets;
|
||||||
|
|
||||||
|
use App\Enums\ApprovalStatus;
|
||||||
use App\Models\Report;
|
use App\Models\Report;
|
||||||
use BezhanSalleh\FilamentShield\Traits\HasWidgetShield;
|
use BezhanSalleh\FilamentShield\Traits\HasWidgetShield;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
@ -27,7 +28,7 @@ protected function getData(): array
|
|||||||
$data = Report::query()
|
$data = Report::query()
|
||||||
->select(
|
->select(
|
||||||
DB::raw('COUNT(*) as count'),
|
DB::raw('COUNT(*) as count'),
|
||||||
DB::raw('status'),
|
'status',
|
||||||
DB::raw("DATE_FORMAT(created_at, '%Y-%m') as month")
|
DB::raw("DATE_FORMAT(created_at, '%Y-%m') as month")
|
||||||
)
|
)
|
||||||
->when($startDate, fn ($q) => $q->whereDate('created_at', '>=', $startDate))
|
->when($startDate, fn ($q) => $q->whereDate('created_at', '>=', $startDate))
|
||||||
@ -44,9 +45,10 @@ protected function getData(): array
|
|||||||
$rejectedData = [];
|
$rejectedData = [];
|
||||||
|
|
||||||
foreach ($months as $month) {
|
foreach ($months as $month) {
|
||||||
$acceptedData[] = $data->where('month', $month)->accepted()->first()?->count ?? 0;
|
$monthData = $data->where('month', $month);
|
||||||
$pendingData[] = $data->where('month', $month)->pending()->first()?->count ?? 0;
|
$acceptedData[] = $monthData->where('status', ApprovalStatus::ACCEPTED)->first()?->count ?? 0;
|
||||||
$rejectedData[] = $data->where('month', $month)->rejected()->first()?->count ?? 0;
|
$pendingData[] = $monthData->where('status', ApprovalStatus::PENDING)->first()?->count ?? 0;
|
||||||
|
$rejectedData[] = $monthData->where('status', ApprovalStatus::REJECTED)->first()?->count ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Enums\ApprovalStatus;
|
use App\Enums\ApprovalStatus;
|
||||||
|
use Illuminate\Database\Eloquent\Attributes\Scope;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
@ -27,6 +29,24 @@ protected function casts(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Scope]
|
||||||
|
protected function accepted(Builder $query): void
|
||||||
|
{
|
||||||
|
$query->where('status', ApprovalStatus::ACCEPTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Scope]
|
||||||
|
protected function pending(Builder $query): void
|
||||||
|
{
|
||||||
|
$query->where('status', ApprovalStatus::PENDING);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Scope]
|
||||||
|
protected function rejected(Builder $query): void
|
||||||
|
{
|
||||||
|
$query->where('status', ApprovalStatus::REJECTED);
|
||||||
|
}
|
||||||
|
|
||||||
public function mediaTaskAssignment(): BelongsTo
|
public function mediaTaskAssignment(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(MediaTaskAssignment::class);
|
return $this->belongsTo(MediaTaskAssignment::class);
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
use App\Livewire\Home\Index;
|
use App\Livewire\Home\Index;
|
||||||
use App\Livewire\Home\News\Index as NewsIndex;
|
use App\Livewire\Home\News\Index as NewsIndex;
|
||||||
use App\Livewire\Home\News\Show as NewsShow;
|
use App\Livewire\Home\News\Show as NewsShow;
|
||||||
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::middleware([TrackVisitor::class])->group(function () {
|
Route::middleware([TrackVisitor::class])->group(function () {
|
||||||
@ -23,3 +25,19 @@
|
|||||||
|
|
||||||
Route::get('/contact-us', ContactUs::class)->name('contact-us');
|
Route::get('/contact-us', ContactUs::class)->name('contact-us');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::get('/email/verify', function () {
|
||||||
|
return view('auth.verify-email');
|
||||||
|
})->middleware('auth')->name('verification.notice');
|
||||||
|
|
||||||
|
Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) {
|
||||||
|
$request->fulfill();
|
||||||
|
|
||||||
|
return redirect('/home');
|
||||||
|
})->middleware(['auth', 'signed'])->name('verification.verify');
|
||||||
|
|
||||||
|
Route::post('/email/verification-notification', function (Request $request) {
|
||||||
|
$request->user()->sendEmailVerificationNotification();
|
||||||
|
|
||||||
|
return back()->with('message', 'Verification link sent!');
|
||||||
|
})->middleware(['auth', 'throttle:6,1'])->name('verification.send');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user