Merge branch 'zain/delivery-info' of gitlab.com:CIEFWorldwideSdnBhd/izyim-api into zain/delivery-info

This commit is contained in:
Asif
2018-06-20 11:05:04 +08:00
3 changed files with 47 additions and 18 deletions
@@ -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);
}
+1
View File
@@ -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');
+40 -16
View File
@@ -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()
// {