mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 20:34:08 +00:00
add bookingcontroller@report, still in testing
This commit is contained in:
@@ -11,6 +11,7 @@ use App\UserBankSlip;
|
||||
use App\User;
|
||||
use App\Invoice;
|
||||
use App\SettingCredit;
|
||||
use Anam\PhantomMagick\Converter;
|
||||
use Auth;
|
||||
use Validator;
|
||||
use DateTime;
|
||||
@@ -635,13 +636,13 @@ class BookingController extends Controller
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
|
||||
public function report(Request $request){
|
||||
$conv = new \Anam\PhantomMagick\Converter();
|
||||
$conv->source('http://google.com')
|
||||
->toPng()
|
||||
->save('/your/destination//google.png');
|
||||
$conv->toPng();
|
||||
|
||||
}
|
||||
public function report(Request $request, $id)
|
||||
{
|
||||
$conv = new Converter();
|
||||
// $conv->setBinary('/vendor/anam/phantomjs-linux-x86-binary/bin/phantomjs');
|
||||
$conv->addPage('<html><body><h1>Welcome to PhantomMagick</h1></body></html>')
|
||||
->save('/storage/app/report/multipage.pdf');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,7 @@ Route::group(['middleware' => ['role:admin']], function() {
|
||||
Route::patch('/booking/{id}/update-china-bankslip','ChinaBankSlipController@update');
|
||||
|
||||
Route::get('/booking/{id}/po', 'BookingController@showPurchaseOrder');
|
||||
Route::post('/booking/{id}/supplier-booking-report','BookingController@report');
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ class BookingTest extends TestCase
|
||||
->assertSuccessful();
|
||||
}
|
||||
|
||||
// Only this is Admin permision required
|
||||
// Admin permision required
|
||||
public function testUploadInvoice(){
|
||||
$this->user->roles()->sync([]);
|
||||
$this->user->attachRole(Role::Where('name','admin')->first());
|
||||
@@ -179,4 +179,17 @@ class BookingTest extends TestCase
|
||||
$response->assertSuccessful();
|
||||
}
|
||||
}
|
||||
|
||||
// Admin permision required
|
||||
public function testReport(){
|
||||
$this->user->roles()->sync([]);
|
||||
$this->user->attachRole(Role::Where('name','admin')->first());
|
||||
|
||||
$response =
|
||||
$this->actingAs($this->user)
|
||||
->json('POST', '/api/booking/' . $this->booking->id . '/supplier-booking-report', [
|
||||
'amount' => '12345'
|
||||
]);
|
||||
dd($response->getContent());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user