change some part of code
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Services\CMMS;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -13,8 +14,6 @@ class DailyMovingMachinesService
|
||||
protected string $password;
|
||||
protected string $channelName;
|
||||
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('cmms_web_services.CHECK_ACTIVITY.url');
|
||||
@@ -26,12 +25,11 @@ class DailyMovingMachinesService
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function run(): array
|
||||
public function run(): Collection
|
||||
{
|
||||
try {
|
||||
return $this->sendRequest();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return collect( $this->sendRequest());
|
||||
} catch (Exception $e) {
|
||||
Log::channel($this->channelName)
|
||||
->error(get_class($this),
|
||||
[
|
||||
@@ -56,13 +54,11 @@ class DailyMovingMachinesService
|
||||
|
||||
private function makeInputParameters(): string
|
||||
{
|
||||
$inputData = array(
|
||||
"username" => $this->username,
|
||||
"password" => $this->password,
|
||||
"day" => today(),
|
||||
"minMileage" => 10,
|
||||
);
|
||||
|
||||
return json_encode($inputData);
|
||||
return json_encode([
|
||||
"username" => $this->username,
|
||||
"password" => $this->password,
|
||||
"day" => today(),
|
||||
"minMileage" => 10,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,16 @@
|
||||
|
||||
namespace App\Services\Cartables\Mission;
|
||||
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\DailyMoveMachine;
|
||||
use App\Models\Damage;
|
||||
use App\Models\SafetyAndPrivacy;
|
||||
use App\Models\AssignmentFails;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DailyMoveMachineService
|
||||
{
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
return DataTableFacade::run(
|
||||
DailyMoveMachine::query(),
|
||||
AssignmentFails::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
|
||||
Reference in New Issue
Block a user