mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 12:34:13 +00:00
100 lines
2.3 KiB
PHP
100 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Booking;
|
|
|
|
class BookingController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
return response()->json(['success' => true, 'message'=> "You have successfully logged out."]);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create()
|
|
{
|
|
return response()->json(['success' => true, 'message'=> "Hohohoho"]);
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
$booking = Booking::create($request->all());
|
|
return response()->json($booking, 201);
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show($id)
|
|
{
|
|
// $booking = Booking::find($id);
|
|
return view('booking.index');
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update(Request $request, $booking)
|
|
{
|
|
// $booking->update($request->all());
|
|
// $this->validate($request, [
|
|
// 'account_name' => 'required',
|
|
// 'account_num' => 'required'
|
|
// ]);
|
|
//Update Post
|
|
$booking = Booking::find($booking);
|
|
// $booking->account_name = 'hello';
|
|
// $booking->account_num = 'account_num';
|
|
$booking->save();
|
|
return response()->json($booking, 200);
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function delete(Booking $booking)
|
|
{
|
|
$booking->delete($booking);
|
|
|
|
return response()->json($booking, 204);
|
|
}
|
|
}
|