atcheck/app/Http/Controllers/Admin/AdminRoomsController.php
2019-12-01 19:31:49 +01:00

46 lines
1.0 KiB
PHP

<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\User;
use App\Subject;
use App\Room;
use App\Classes;
use App\Attendance;
class AdminRoomsController extends Controller
{
public function index()
{
$rooms = Room::all();
return view('admin.admin_rooms', ['rooms' => $rooms]);
}
public function add_room(Request $request)
{
$name = $request->input('name');
$capacity = $request->input('capacity');
$arrangement = $request->input('arrangement');
Room::create([
'name' => $name,
'capacity' => $capacity,
'arrangement' => $arrangement
]);
return redirect(route('admin_rooms'));
}
public function delete_room($room_id)
{
Room::find($room_id)->delete();
return redirect(route('admin_rooms'));
}
public function edit_room($room_id)
{
Room::find($room_id);
return redirect(route('admin_rooms'));
}
}