task-5 (Lessons and Scores) #5
10
app/Http/Controllers/ScoreController.php
Normal file
10
app/Http/Controllers/ScoreController.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ScoreController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
30
app/Services/ScoreService.php
Normal file
30
app/Services/ScoreService.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Lesson;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ScoreService implements ServiceInterface
|
||||
{
|
||||
|
||||
public function getAll(?Lesson $lesson = null)
|
||||
{
|
||||
return $lesson->grade->students;
|
||||
}
|
||||
|
||||
public function create(array $data): Model
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function update(Model $model, array $data): Model
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
}
|
||||
|
||||
public function delete(Model $model)
|
||||
{
|
||||
// TODO: Implement delete() method.
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container col-md-4">
|
||||
<div class="row justify-content-center">
|
||||
<div class="card mt-4">
|
||||
<div class="card-header">{{__('Классы')}}</div>
|
||||
<div class="card-body">
|
||||
@if (count($grades))
|
||||
<div class="list-group">
|
||||
@foreach ($grades as $grade)
|
||||
<a href="{{ route('grades.lessons.index', $grade) }}" class="list-group-item list-group-item-action d-flex justify-content-center">{{ $grade->name }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<p>Классы отсутствуют</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -20,6 +20,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="{{ route('lessons.students.index', $lesson) }}" class="btn btn-success">Оценки</a>
|
||||
<a href="{{ route('grades.lessons.edit', [$grade, $lesson]) }}" class="btn btn-primary">Редактировать</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -36,16 +36,16 @@
|
||||
class="btn btn-block col-8">{{ $grade->name }}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<a href="{{ route('grades.lessons.index', $grade) }}" class="btn btn-primary">Занятия</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<a href="{{ route('grades.edit', $grade) }}" class="btn btn-warning">Редактировать</a>
|
||||
</div>
|
||||
</td>
|
||||
{{-- <td>--}}
|
||||
{{-- <div>--}}
|
||||
{{-- <a href="{{ route('journals.index', $grade) }}" class="btn btn-primary">Журнал</a>--}}
|
||||
{{-- </div>--}}
|
||||
{{-- </td>--}}
|
||||
<td>
|
||||
<form action="{{ route('grades.destroy', $grade) }}" method="POST"
|
||||
style="display: inline-block;">
|
||||
|
@ -3,7 +3,6 @@
|
||||
<ul class="nav justify-content-center pb-3 mb-3">
|
||||
<li class="nav-item"><a href="{{ route('grades.index') }}" class="nav-link px-2 text-muted">Классы</a></li>
|
||||
<li class="nav-item"><a href="{{ route('subjects.index') }}" class="nav-link px-2 text-muted">Предметы</a></li>
|
||||
<li class="nav-item"><a href="{{ route('grades.lessons.grades-list') }}" class="nav-link px-2 text-muted">Занятия</a></li>
|
||||
<li class="nav-item"><a href="{{ route('students.index') }}" class="nav-link px-2 text-muted">Студенты</a></li>
|
||||
<li class="nav-item"><a href="{{ route('teachers.index') }}" class="nav-link px-2 text-muted">Учителя</a></li>
|
||||
</ul>
|
||||
|
@ -3,7 +3,6 @@
|
||||
<ul class="nav nav-pills">
|
||||
<li class="nav-item"><a href="{{ route('grades.index') }}" class="nav-link @if(request()->is('grades*')) active @endif" aria-current="page">Классы</a></li>
|
||||
<li class="nav-item"><a href="{{ route('subjects.index') }}" class="nav-link @if(request()->is('subjects*')) active @endif">Предметы</a>
|
||||
<li class="nav-item"><a href="{{ route('grades.lessons.grades-list') }}" class="nav-link @if(request()->is('grades/{grade}/lessons*')) active @endif">Занятия</a></li>
|
||||
<li class="nav-item"><a href="{{ route('students.index') }}" class="nav-link @if(request()->is('students*')) active @endif">Ученики</a></li>
|
||||
<li class="nav-item"><a href="{{ route('teachers.index') }}" class="nav-link @if(request()->is('teachers*')) active @endif">Учителя</a></li>
|
||||
</ul>
|
||||
|
@ -25,4 +25,4 @@ Route::resources([
|
||||
Route::resource('teachers.subjects', SubjectTeacherController::class)->except('index');
|
||||
Route::resource('teachers.subjects.grades', GradeTeacherController::class)->except('index', 'show');
|
||||
Route::resource('grades.subjects', GradeSubjectController::class)->except('index', 'show');
|
||||
Route::get('lessons/grade-list', [LessonController::class, 'gradeList'])->name('grades.lessons.grades-list');
|
||||
Route::resource('lessons.students', ScoreController::class)->except('show');
|
||||
|
Loading…
Reference in New Issue
Block a user