Skip to content

Commit

Permalink
show
Browse files Browse the repository at this point in the history
  • Loading branch information
farahamaliaa committed Jul 16, 2024
1 parent bdab3e0 commit a3d97fd
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
5 changes: 5 additions & 0 deletions app/Contracts/Repositories/StudentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public function whereSchool(mixed $id): mixed
{
return $this->model->query()->where('school_id', $id)->latest()->paginate(10);
}

public function doesntHaveClassroom(): mixed
{
return $this->model->
}
}
3 changes: 2 additions & 1 deletion app/Http/Controllers/ClassroomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public function store(StoreClassroomRequest $request)
*/
public function show(Classroom $classroom)
{
return view('school.pages.class.detail-class', compact('classroom '));
$schoolYears = $this->schoolYear->whereSchool(auth()->user()->school->id);
return view('school.pages.class.detail-class', compact('classroom', 'schoolYears'));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Classroom.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ class Classroom extends Model
'school_year_id',
'level_class_id'
];

public $incrementing = false;
public $keyType = 'char';
}
8 changes: 6 additions & 2 deletions resources/views/school/pages/class/detail-class.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
<div class="d-flex flex-wrap">
<select id="tahun-ajaran" class="form-select">
<option value="">Tahun Ajaran</option>
<option value="">2023/2024</option>
@forelse ($schoolYears as $schoolYear)
<option value="{{ $schoolYear->id }}">{{ $schoolYear->school_year }}</option>
@empty
<option>Belum ada tahun ajaran</option>
@endforelse
</select>
</div>
</div>

<div class="card card-body">
<div class="d-flex justify-content-between">
<div>
<h4>XII RPL 2</h4>
<h4>{{ $classroom->name }}</h4>
<div>
<p>Pilih siswa di sebelah kiri untuk memasukkan siswa ke dalam Kelas</p>
</div>
Expand Down
3 changes: 1 addition & 2 deletions resources/views/school/pages/class/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ class="icon icon-tabler icons-tabler-outline icon-tabler-users">
</span>
</div>
</div>
<a href="{{ route('detail-class.index') }}" type="button"
class="btn waves-effect waves-light btn-primary w-100">Masuk Kelas</a>
<a href="{{ route('class.show', $classroom->id) }}" type="button" class="btn waves-effect waves-light btn-primary w-100">Masuk Kelas</a>
</div>
</div>
</div>
Expand Down
18 changes: 7 additions & 11 deletions routes/role/school.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,10 @@
});













//kelas
Route::get('school/class', [ClassroomController::class, 'index'])->name('class.index');
Route::post('school/add-class', [ClassroomController::class, 'store'])->name('class.store');
Route::put('school/update-class/{classroom}', [ClassroomController::class, 'update'])->name('class.update');
Route::delete('school/delete-class/{classroom}', [ClassroomController::class, 'destroy'])->name('class.delete');
// detail kelas
Route::get('school/{classroom}', [ClassroomController::class, 'show'])->name('class.show');

0 comments on commit a3d97fd

Please sign in to comment.