Initial Laravel API import
Some checks failed
continuous-integration/drone/push Build is failing

- Complete GGZ Ecademy Laravel backend application
- RESTful API for learning products, members, filters
- Authentication and authorization system
- Database migrations and seeders
- Custom CRUD generator commands
- Email notification system
- Integration with frontend applications
This commit is contained in:
Joris Slagter
2025-12-02 17:40:21 +01:00
parent 786b6b6a78
commit df155bb13d
341 changed files with 116385 additions and 2 deletions

View File

@@ -0,0 +1,80 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Artisan;
use App\Services\CourseNotificationService;
use App\Http\Requests\Learning\CourseNotificationStore;
class CourseNotificationController extends Controller
{
private $courseNotificationService;
public function __construct(CourseNotificationService $courseNotificationService)
{
$this->courseNotificationService = $courseNotificationService;
$this->middleware('auth:sanctum');
}
public function index()
{
if (!auth()->user()->hasRole('admin')) {
return response()->json(['message' => 'You have no rights to do this'], 401);
}
$course_notifications = $this->courseNotificationService->getAll();
return response()->json($course_notifications, 201);
}
public function store(CourseNotificationStore $request)
{
$isSuperAdmin = auth()->user()->hasRole('super_admin');
$isAdmin = auth()->user()->hasRole('admin');
$isOperator = auth()->user()->hasRole('operator');
if (!$isSuperAdmin && !$isAdmin && !$isOperator) {
return response()->json(['message' => 'You have no rights to do this'], 401);
}
$course_notification = $this->courseNotificationService->save($request->validated());
return response()->json($course_notification, 201);
}
public function show($id)
{
$course_notification = $this->courseNotificationService->get($id);
return response()->json($course_notification);
}
public function destroy($id)
{
$isSuperAdmin = auth()->user()->hasRole('super_admin');
$isAdmin = auth()->user()->hasRole('admin');
$isOperator = auth()->user()->hasRole('operator');
if (!$isSuperAdmin && !$isAdmin && !$isOperator) {
return response()->json(['message' => 'You have no rights to do this'], 401);
}
$this->courseNotificationService->delete($id);
return response()->json(null, 204);
}
public function testCommand()
{
$isSuperAdmin = auth()->user()->hasRole('super_admin');
$isAdmin = auth()->user()->hasRole('admin');
$isOperator = auth()->user()->hasRole('operator');
if (!$isSuperAdmin && !$isAdmin && !$isOperator) {
return response()->json(['message' => 'You have no rights to do this'], 401);
}
Artisan::call('send:lp-notifications');
return 0;
}
}