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