<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\User; use App\Subject; use App\Room; use App\Classes; use App\Attendance; class AdminPanelController extends Controller { public function index() { return view('layouts.adminpanel'); } public function users() { $users = User::all(); return view('admin.admin_users', ['users' => $users]); } public function subjects() { $subjects = Subject::all(); return view('admin.admin_subjects', ['subjects' => $subjects]); } public function rooms() { $rooms = Room::all(); return view('admin.admin_rooms', ['rooms' => $rooms]); } public function classes() { $classes = Classes::all(); return view('admin.admin_classes', ['classes' => $classes]); } public function attendances() { $attendances = Attendance::all(); return view('admin.admin_attendances', ['attendances' => $attendances]); } public function delete_user($user_id) { User::find($user_id)->delete(); return redirect('admin_users'); } public function delete_subject($subject_id) { Subject::find($subject_id)->delete(); return redirect('admin_subjects'); } public function delete_room($room_id) { Room::find($room_id)->delete(); return redirect('admin_rooms'); } public function delete_classes($classes_id) { Classes::find($classes_id)->delete(); return redirect('admin_classes'); } public function delete_attendance($attendance_id) { Attendance::find($attendance_id)->delete(); return redirect('admin_attendances'); } public function add_user(Request $request) { $name = $request->input('name'); $surname = $request->input('surname'); $id_number = $request->input('id_number'); return redirect(route('admin_users')); } public function add_subject(Request $request) { $name = $request->input('name'); $surname = $request->input('surname'); $id_number = $request->input('id_number'); return redirect('admin_subjects'); } public function add_room(Request $request) { $name = $request->input('name'); $surname = $request->input('surname'); $id_number = $request->input('id_number'); return redirect('admin_rooms'); } public function add_classes(Request $request) { $name = $request->input('name'); $surname = $request->input('surname'); $id_number = $request->input('id_number'); return redirect('admin_classes'); } public function add_attendance(Request $request) { $name = $request->input('name'); $surname = $request->input('surname'); $id_number = $request->input('id_number'); return redirect('admin_attendances'); } }