Added more routes.
This commit is contained in:
@@ -9,6 +9,17 @@ use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware([ "auth" ])->only("logout");
|
||||
$this->middleware([ "guest" ])->only("login");
|
||||
|
||||
$this->middleware([ "permission:user.list", "role:admin" ])->only("index");
|
||||
$this->middleware([ "permission:user.show", "role:admin" ])->only("show");
|
||||
$this->middleware([ "permission:user.edit", "role:admin" ])->only([ "edit", "update" ]);
|
||||
$this->middleware([ "permission:user.delete", "role:admin" ])->only("delete");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
|
||||
@@ -3,60 +3,75 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\WashingReservation;
|
||||
|
||||
class WashingReservationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
//
|
||||
$reservations = WashingReservation::query()->paginate($request->query("page", 1));
|
||||
|
||||
return view("washing-reservation.index");
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
return view("washing-reservation.create");
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$data = $request->validate([
|
||||
"time" => "required"
|
||||
]);
|
||||
|
||||
$machineReservation = new WashingReservation($data);
|
||||
$machineReservation->save();
|
||||
|
||||
return view("washing-reservation.store");
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
$machineReservation = WashingReservation::find($id);
|
||||
|
||||
return view("washing-reservation.show", [
|
||||
"machineReservation" => $machineReservation
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
return view("washing-reservation.edit");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,21 +79,36 @@ class WashingReservationController extends Controller
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$data = $request->validate([
|
||||
"time" => "required"
|
||||
]);
|
||||
|
||||
$machineReservation = WashingReservation::find($id);
|
||||
|
||||
$machineReservation->update($data);
|
||||
|
||||
$machineReservation->save();
|
||||
|
||||
return view("washing-reservation.edit", [
|
||||
"washingReservation" => $machineReservation
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
$machineReservation = WashingReservation::find($id);
|
||||
$machineReservation->delete();
|
||||
|
||||
return view("washing-reservation.delete");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user