initial project
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Frontend;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
use App\Libraries\Lalamove;
|
||||
use App\Models\LogLalamove;
|
||||
|
||||
class LalamoveController extends BaseController
|
||||
{
|
||||
protected $lalamove;
|
||||
use ResponseTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->lalamove = new Lalamove();
|
||||
}
|
||||
|
||||
public function webhook()
|
||||
{
|
||||
// $log_lalamove = new LogLalamove();
|
||||
// $log_lalamove->insert([
|
||||
// 'url' => 'https://icom.ipsgroup.com.my/api/lalamove/webhook',
|
||||
// 'request' => json_encode($this->request->getJSON(true)),
|
||||
// 'respond' => 'Webhook received',
|
||||
// ]);
|
||||
$rawBody = file_get_contents('php://input');
|
||||
$data = json_decode($rawBody, true);
|
||||
if($data){
|
||||
$this->lalamove->handleWebhook($data);
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 200,
|
||||
'message' => 'Webhook received'
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user