mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
Merge branch 'zain/delivery-info' of gitlab.com:CIEFWorldwideSdnBhd/izyim-api into zain/delivery-info
This commit is contained in:
@@ -9,6 +9,11 @@ use Auth;
|
||||
|
||||
class DeliveryinfoController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->get();
|
||||
return response()->json($deliveryinfo, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified delivery-info.
|
||||
@@ -18,8 +23,7 @@ class DeliveryinfoController extends Controller
|
||||
*/
|
||||
public function show(Deliveryinfo $id)
|
||||
{
|
||||
$deliveryinfo = deliveryinfo::find($id);
|
||||
|
||||
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
|
||||
return response()->json($deliveryinfo, 200);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ Route::group(['middleware' => ['jwt.auth']], function() {
|
||||
|
||||
|
||||
/*Delivery-Info in profile menu*/
|
||||
Route::get('/deliveryinfo','DeliveryinfoController@index');
|
||||
Route::get('/deliveryinfo/{com_id}','DeliveryinfoController@show');
|
||||
Route::post('/deliveryinfo', 'DeliveryinfoController@store');
|
||||
Route::put('/deliveryinfo/{com_id}', 'DeliveryinfoController@update');
|
||||
|
||||
@@ -28,26 +28,50 @@ class DeliveryinfoTest extends TestCase
|
||||
});
|
||||
}
|
||||
|
||||
public function testPUT()
|
||||
{
|
||||
// TODO : those test is wrong, please redo later.
|
||||
|
||||
$response = $this->actingAs($this->company)
|
||||
->patchJson('/api/deliveryinfo', [
|
||||
// public function testCreate()
|
||||
// {
|
||||
|
||||
'branch' => 'Test',
|
||||
'deli_info' => 'Testing',
|
||||
'address' => 'Testing',
|
||||
'city' => 'Test',
|
||||
'postcode' => '12345',
|
||||
'state' => 'Testing',
|
||||
'country' => 'Testing',
|
||||
'contact_person' => 'Testing',
|
||||
'contact_person_no' => '12345'
|
||||
// $response = $this->actingAs($this->company)
|
||||
// ->patchJson('/api/deliveryinfo', [
|
||||
|
||||
// 'branch' => 'Test',
|
||||
// 'deli_info' => 'Testing',
|
||||
// 'address' => 'Testing',
|
||||
// 'city' => 'Test',
|
||||
// 'postcode' => '12345',
|
||||
// 'state' => 'Testing',
|
||||
// 'country' => 'Testing',
|
||||
// 'contact_person' => 'Testing',
|
||||
// 'contact_person_no' => '12345'
|
||||
|
||||
]);
|
||||
// ]);
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
// $response->assertStatus(201);
|
||||
// }
|
||||
|
||||
|
||||
// public function testPUT()
|
||||
// {
|
||||
|
||||
// $response = $this->actingAs($this->company)
|
||||
// ->patchJson('/api/deliveryinfo', [
|
||||
|
||||
// 'branch' => 'Test',
|
||||
// 'deli_info' => 'Testing',
|
||||
// 'address' => 'Testing',
|
||||
// 'city' => 'Test',
|
||||
// 'postcode' => '12345',
|
||||
// 'state' => 'Testing',
|
||||
// 'country' => 'Testing',
|
||||
// 'contact_person' => 'Testing',
|
||||
// 'contact_person_no' => '12345'
|
||||
|
||||
// ]);
|
||||
|
||||
// $response->assertStatus(200);
|
||||
// }
|
||||
|
||||
// public function testDELETE()
|
||||
// {
|
||||
|
||||
Reference in New Issue
Block a user