Fix
This commit is contained in:
parent
2e3d757a53
commit
b088c3d624
@ -47,4 +47,9 @@ class StudentPolicy
|
||||
{
|
||||
return $user->userable_type != Admin::class;
|
||||
}
|
||||
|
||||
public function debts(User $user): bool
|
||||
{
|
||||
return $user->userable_type == Student::class;
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,17 @@
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Admin;
|
||||
use App\Models\Student;
|
||||
use App\Models\Subject;
|
||||
use App\Models\Teacher;
|
||||
use App\Models\User;
|
||||
|
||||
class SubjectPolicy
|
||||
{
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->userable_type != Teacher::class;
|
||||
}
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
@ -31,4 +37,9 @@ class SubjectPolicy
|
||||
{
|
||||
return $user->userable_type == Admin::class;
|
||||
}
|
||||
|
||||
public function scores(User $user, Subject $subject): bool
|
||||
{
|
||||
return $user->userable_type == Student::class;
|
||||
}
|
||||
}
|
||||
|
@ -48,4 +48,9 @@ class TeacherPolicy
|
||||
{
|
||||
return $user->userable_type == Admin::class;
|
||||
}
|
||||
|
||||
public function teacherSubjects(User $user, Teacher $teacher): bool
|
||||
{
|
||||
return $user->userable_type == Student::class;
|
||||
}
|
||||
}
|
||||
|
@ -5,49 +5,49 @@
|
||||
<div class="flex">
|
||||
<!-- Logo -->
|
||||
<div class="shrink-0 flex items-center">
|
||||
<a href="{{ route('grades.index') }}">
|
||||
<x-application-logo class="block h-9 w-auto fill-current text-gray-800" />
|
||||
</a>
|
||||
<x-application-logo class="block h-9 w-auto fill-current text-gray-800" />
|
||||
</div>
|
||||
|
||||
<!-- Navigation Links -->
|
||||
@if(\Illuminate\Support\Facades\Auth::user()->userable_type != \App\Models\Student::class)
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||
<x-nav-link :href="route('grades.index')" :active="request()->routeIs('grades.index')">
|
||||
{{ __('Классы') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
@endif
|
||||
@can('viewAny', \App\Models\Grade::class)
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||
<x-nav-link :href="route('grades.index')" :active="request()->routeIs('grades.index')">
|
||||
{{ __('Классы') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||
<x-nav-link :href="route('subjects.index')" :active="request()->routeIs('subjects.index')">
|
||||
{{ __('Предметы') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
@can('viewAny', \App\Models\Subject::class)
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||
<x-nav-link :href="route('subjects.index')" :active="request()->routeIs('subjects.index')">
|
||||
{{ __('Предметы') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@if(\Illuminate\Support\Facades\Auth::user()->userable_type != \App\Models\Student::class)
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||
<x-nav-link :href="route('students.index')" :active="request()->routeIs('students.index')">
|
||||
{{ __('Студенты') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
@endif
|
||||
@can('viewAny', \App\Models\Student::class)
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||
<x-nav-link :href="route('students.index')" :active="request()->routeIs('students.index')">
|
||||
{{ __('Студенты') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@if(\Illuminate\Support\Facades\Auth::user()->userable_type != \App\Models\Teacher::class)
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||
<x-nav-link :href="route('teachers.index')" :active="request()->routeIs('teachers.index')">
|
||||
{{ __('Учителя') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
@endif
|
||||
@can('viewAny', \App\Models\Teacher::class)
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||
<x-nav-link :href="route('teachers.index')" :active="request()->routeIs('teachers.index')">
|
||||
{{ __('Учителя') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@if(\Illuminate\Support\Facades\Auth::user()->userable_type == \App\Models\Student::class)
|
||||
@can('debts', \App\Models\Student::class)
|
||||
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
|
||||
<x-nav-link :href="route('student-debts')" :active="request()->routeIs('student-debts')">
|
||||
{{ __('Задолженности') }}
|
||||
</x-nav-link>
|
||||
</div>
|
||||
@endif
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<!-- Settings Dropdown -->
|
||||
@ -99,9 +99,35 @@
|
||||
<!-- Responsive Navigation Menu -->
|
||||
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
|
||||
<div class="pt-2 pb-3 space-y-1">
|
||||
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
|
||||
{{ __('Dashboard') }}
|
||||
</x-responsive-nav-link>
|
||||
@can('viewAny', \App\Models\Grade::class)
|
||||
<x-responsive-nav-link :href="route('grades.index')" :active="request()->routeIs('grades.index')">
|
||||
{{ __('Классы') }}
|
||||
</x-responsive-nav-link>
|
||||
@endcan
|
||||
|
||||
@can('viewAny', \App\Models\Subject::class)
|
||||
<x-responsive-nav-link :href="route('subjects.index')" :active="request()->routeIs('subjects.index')">
|
||||
{{ __('Предметы') }}
|
||||
</x-responsive-nav-link>
|
||||
@endcan
|
||||
|
||||
@can('viewAny', \App\Models\Student::class)
|
||||
<x-responsive-nav-link :href="route('students.index')" :active="request()->routeIs('students.index')">
|
||||
{{ __('Студенты') }}
|
||||
</x-responsive-nav-link>
|
||||
@endcan
|
||||
|
||||
@can('viewAny', \App\Models\Teacher::class)
|
||||
<x-responsive-nav-link :href="route('teachers.index')" :active="request()->routeIs('teachers.index')">
|
||||
{{ __('Учителя') }}
|
||||
</x-responsive-nav-link>
|
||||
@endcan
|
||||
|
||||
@can('debts', \App\Models\Student::class)
|
||||
<x-responsive-nav-link :href="route('student-debts')" :active="request()->routeIs('student-debts')">
|
||||
{{ __('Задолженности') }}
|
||||
</x-responsive-nav-link>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<!-- Responsive Settings Options -->
|
||||
|
@ -34,11 +34,13 @@
|
||||
{{ $subject->name }}
|
||||
</div>
|
||||
</td>
|
||||
@can('scores', $subject)
|
||||
<td>
|
||||
<div>
|
||||
<a href="{{ route('student-scores', $subject) }}" class="btn btn-success">Оценки</a>
|
||||
</div>
|
||||
</td>
|
||||
@endcan
|
||||
@can('update', $subject)
|
||||
<td>
|
||||
<div>
|
||||
|
@ -31,14 +31,20 @@
|
||||
<tr>
|
||||
<td class="table-text">
|
||||
<div>
|
||||
{{ $teacher->fio }}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<a href="{{ route('teachers.subjects.index', $teacher) }}" class="btn btn-warning">Предметы</a>
|
||||
@can('view', $teacher)
|
||||
<a href="{{ route('teachers.show', $teacher) }}" class="btn btn-block">{{ $teacher->fio }}</a>
|
||||
@else
|
||||
{{ $teacher->fio }}
|
||||
@endcan
|
||||
</div>
|
||||
</td>
|
||||
@can('teacherSubjects', $teacher)
|
||||
<td>
|
||||
<div>
|
||||
<a href="{{ route('teachers.subjects.index', $teacher) }}" class="btn btn-warning">Предметы</a>
|
||||
</div>
|
||||
</td>
|
||||
@endcan
|
||||
@can('update', $teacher)
|
||||
<td>
|
||||
<div>
|
||||
|
Loading…
Reference in New Issue
Block a user