Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions app/Http/Controllers/ExcellenceController.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<?php

/**
* @Author: Bernard Hanna
* @Date: 2025-01-29 14:25:28
* @Last Modified by: Bernard Hanna
* @Last Modified time: 2025-03-13 17:52:44
*/

namespace App\Http\Controllers;

use App\CertificateExcellence;
use App\Excellence;
use App\Queries\ExcellenceQuery;
use Gate;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
Expand All @@ -14,27 +20,11 @@ class ExcellenceController extends Controller
{
public function report($edition): View
{

// Check if user is a winner for this edition
if (Gate::denies('report-excellence', $edition)) {
// The current user can't report for excellence...
abort(403, 'You are not eligible to receive a Codeweek4All Excellence Certificate.');

}

return view('excellence.report', compact('edition'));

}

public function generate($edition, Request $request): RedirectResponse
{

if (Gate::denies('report-excellence', $edition)) {
// The current user can't report for excellence...
abort(403, 'You are not eligible to receive a Codeweek4All Excellence Certificate.');

}

$rules = [
'name_for_certificate' => 'required|max:40|regex:/^[^ə]*$/u',
];
Expand All @@ -56,6 +46,5 @@ public function generate($edition, Request $request): RedirectResponse
]);

return redirect('certificates');

}
}
13 changes: 10 additions & 3 deletions app/Queries/ReportableEventsQuery.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php

/**
* @Author: Bernard Hanna
* @Date: 2025-01-29 14:25:28
* @Last Modified by: Bernard Hanna
* @Last Modified time: 2025-03-12 17:57:08
*/


/**
* Created by PhpStorm.
* User: doris
Expand All @@ -25,17 +34,15 @@ public static function reportable()
})
->where('start_date', '<=', Carbon::now())
->orderBy('end_date', 'desc')->paginate(20);

}

public static function reported()
{

return Event::where('status', 'APPROVED')
->where('creator_id', '=', Auth::user()->id)
->where('reported_at', '<>', null)
->whereNotNull('reported_at')
->where('start_date', '<=', Carbon::now())
->orderBy('created_at', 'desc')->paginate(20);

}
}
Loading