Viewing file: NotificationController.php (1.65 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Http\Controllers;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
class NotificationController extends Controller
{
public function lowStock(Request $req)
{
try{
try {
$req_body=array_merge($req->all(), ['vendor_id' => auth()->user()['id'],"stage"=>"lowstock"]);
$client = new Client([
'auth' => ['Notification', 'jiFFNotification@2023!@!@!@']
]);
$res = $client->request('POST', 'https://notification.businesscloud.xyz/product',["json"=>$req_body]);
} catch (\Throwable $th) {
//throw $th;
}
return response()->json(['message' =>"done"]);
} catch (\Exception $exception) {
return response()->json(['error' => 'true', 'message' =>$exception->getMessage()],500);
}
}
public function outOfStock(Request $req)
{
try{
try {
$req_body=array_merge($req->all(), ['vendor_id' => auth()->user()['id'],"stage"=>"outofstock"]);
$client = new Client([
'auth' => ['Notification', 'jiFFNotification@2023!@!@!@']
]);
$res = $client->request('POST', 'https://notification.businesscloud.xyz/product',["json"=>$req_body]);
} catch (\Throwable $th) {
//throw $th;
}
return response()->json(['message' =>"done"]);
} catch (\Exception $exception) {
return response()->json(['error' => 'true', 'message' =>$exception->getMessage()],500);
}
}
}
|