Commit 054d261d authored by Julien Ait azzouzene's avatar Julien Ait azzouzene
Browse files
parents a5ded845 c262945b
Loading
Loading
Loading
Loading
+18 −0
Changes for app/Http/Controllers/fileSecurityController.php: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\DivingSession;
use Illuminate\View\View;


class fileSecurityController extends Controller
{
    function index(): View
    {
        $files = DivingSession::sessionsWithFilledFile();

        return view('sessionslist',['sessions' => $files]);
    }
}
+8 −0
Changes for app/Models/DivingSession.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -22,6 +22,12 @@ class DivingSession extends Model

    use HasFactory;

    static public function sessionsWithFilledFile():array
    {
        $res =  DB::table('CAR_DIVING_SESSION')->get();
        return $res->toArray();
    }

    public function getParticipants(): array{
        $registrations = DB::table('CAR_REGISTRATION')->where('DS_CODE', $this->DS_CODE)->get();
        $participants = [];
@@ -86,4 +92,6 @@ public function getRoleForUser(User $user){
        return "Plongeur";

    }

    
}
+11 −0
Changes for app/Models/User.php: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,17 @@ public function roles()
        return $this->belongsToMany(Role::class, RoleAttribution::class, 'US_ID', 'ROL_CODE');
    }

    public function getRole() {
        return User::select('CAR_ROLE.ROL_LABEL')
            ->join('CAR_ROLE_ATTRIBUTION', 'CAR_USER.US_ID', '=', 'CAR_ROLE_ATTRIBUTION.US_ID')
            ->join('CAR_ROLE', 'CAR_ROLE_ATTRIBUTION.ROL_CODE', '=', 'CAR_ROLE.ROL_CODE')
            ->where('CAR_USER.US_ID',session('user')->US_ID)
            ->pluck('CAR_ROLE.ROL_LABEL')
            ->first();    }
    
    
    

    /**
     * Check if the user has a given role.
     *
+3 −0
Changes for resources/views/components/header.blade.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -26,7 +26,10 @@ class="w-8 h-8 rounded-full py-2 font-bold text-white">{{ substr(session('user')
                    <div class="px-4 py-3">
                        <span
                            class="block text-sm text-white">{{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME }}</span>
                            <span class="mb-2 mt-2 italic block text-sm truncate text-white">{{ session('user')->getRole() }}</span>

                            <span class="block text-sm truncate text-gray-400">{{ session('user')->US_EMAIL }}</span>

                    </div>
                    <ul class="py-2" aria-labelledby="user-menu-button">
                        <li>
+5 −0
Changes for resources/views/components/redirect-button.blade.php: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
<a href="{{ $link }}">
    <div class="hover:bg-gray-300 round btn btn-primary flex flex-col justify-center items-center">
        {{$slot}}
    </div>
</a>
Loading