mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
update api and controller
This commit is contained in:
+2
-1
@@ -6,5 +6,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Booking extends Model
|
||||
{
|
||||
//
|
||||
// protected $guarded = [];
|
||||
protected $fillable = ['account_name', 'account_num', 'bank_name', 'bank_branch', 'company_name', 'company_address', 'bank_address', 'swift_code', 'cnap' ];
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Booking;
|
||||
|
||||
class BookingController extends Controller
|
||||
{
|
||||
@@ -13,7 +14,7 @@ class BookingController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return response()->json(['success' => true, 'message'=> "You have successfully logged out."]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,7 +24,7 @@ class BookingController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
return response()->json(['success' => true, 'message'=> "Hohohoho"]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +35,8 @@ class BookingController extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$booking = Booking::create($request->all());
|
||||
return response()->json($booking, 201);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +47,8 @@ class BookingController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
// $booking = Booking::find($id);
|
||||
return view('booking.index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,9 +69,19 @@ class BookingController extends Controller
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,8 +90,10 @@ class BookingController extends Controller
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function delete(Booking $booking)
|
||||
{
|
||||
//
|
||||
$booking->delete($booking);
|
||||
|
||||
return response()->json($booking, 204);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Laravel</title>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
color: #636b6f;
|
||||
font-family: 'Raleway', sans-serif;
|
||||
font-weight: 100;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.full-height {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.flex-center {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.position-ref {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.top-right {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 84px;
|
||||
}
|
||||
|
||||
.links > a {
|
||||
color: #636b6f;
|
||||
padding: 0 25px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: .1rem;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.m-b-md {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="flex-center position-ref full-height">
|
||||
@if (Route::has('login'))
|
||||
<div class="top-right links">
|
||||
@auth
|
||||
<a href="{{ url('/home') }}">Home</a>
|
||||
@else
|
||||
<a href="{{ route('login') }}">Login</a>
|
||||
<a href="{{ route('register') }}">Register</a>
|
||||
@endauth
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="content">
|
||||
<div class="title m-b-md">
|
||||
Laravelllll
|
||||
</div>
|
||||
|
||||
<div class="links">
|
||||
<a href="https://laravel.com/docs">Documentation</a>
|
||||
<a href="https://laracasts.com">Laracasts</a>
|
||||
<a href="https://laravel-news.com">News</a>
|
||||
<a href="https://forge.laravel.com">Forge</a>
|
||||
<a href="https://github.com/laravel/laravel">GitHub</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+7
-5
@@ -18,15 +18,17 @@ Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
});
|
||||
|
||||
/*Route for the booking */
|
||||
Route::get('/booking/', 'BookingController@index');
|
||||
Route::get('/booking', 'BookingController@index');
|
||||
|
||||
Route::get('/booking/', 'BookingController@show');
|
||||
Route::get('/booking/{booking}', 'BookingController@show');
|
||||
|
||||
Route::post('/booking/{user-id}', 'BookingController@store');
|
||||
Route::post('/booking', 'BookingController@store');
|
||||
|
||||
Route::put('/booking/{booking}', 'BookingController@update');
|
||||
|
||||
Route::delete('/booking/{booking}', 'BookingController@delete');
|
||||
|
||||
Route::put('/booking/{user-id}', 'BookingController@update');
|
||||
|
||||
Route::delete('/booking/{user-id}', 'BookingController@delete');
|
||||
//Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
// return $request->user();
|
||||
//});
|
||||
|
||||
@@ -15,5 +15,18 @@ Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
/*Route for the booking */
|
||||
// Route::get('/booking', 'BookingController@index');
|
||||
|
||||
// Route::get('/booking/{booking}', 'BookingController@show');
|
||||
|
||||
// Route::post('/booking', 'BookingController@create');
|
||||
|
||||
// Route::post('/booking', 'BookingController@store');
|
||||
|
||||
// Route::put('/booking/{user-id}', 'BookingController@update');
|
||||
|
||||
// Route::delete('/booking/{user-id}', 'BookingController@delete');
|
||||
|
||||
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
|
||||
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
|
||||
|
||||
Reference in New Issue
Block a user