mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Update: laravel 8 to 12, php 7.3 to php 8.3, Jenkinsfile, Unit/Feature testing, vapor
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=testing
|
||||||
|
|
||||||
|
APP_KEY=base64:I9qXyDlm7GVu/e47+YGzLB00fA/FMA2/hMPEhqu8pUQ=
|
||||||
|
JWT_SECRET=9j7f7vUWEzxUBjLYcQimZp5wmxHEglcjU3beog26qC4pQKENZSpfWQfv065tjZrZ
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=172.18.0.3
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=ci_test_shipping_portal
|
||||||
|
DB_USERNAME=ci
|
||||||
|
DB_PASSWORD=bi9y@T8r
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
**/.idea/
|
**/.idea/
|
||||||
.env
|
.env
|
||||||
.env.backup
|
.env.backup
|
||||||
|
.env.testing.example
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
Homestead.json
|
Homestead.json
|
||||||
Homestead.yaml
|
Homestead.yaml
|
||||||
@@ -29,3 +30,5 @@ storage/framework/laravel-excel/*
|
|||||||
.env.production
|
.env.production
|
||||||
.env.staging
|
.env.staging
|
||||||
.env.development
|
.env.development
|
||||||
|
docz/*
|
||||||
|
.phpunit.cache/
|
||||||
|
|||||||
Vendored
+48
-17
@@ -9,17 +9,17 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
args '--group-add 992 -v /var/run/docker.sock:/var/run/docker.sock'
|
args '--network ci-net --group-add 992 -v /var/run/docker.sock:/var/run/docker.sock'
|
||||||
image '303644228504.dkr.ecr.ap-southeast-1.amazonaws.com/jenkins-pipeline-agent:latest'
|
image '303644228504.dkr.ecr.ap-southeast-1.amazonaws.com/jenkins-pipeline-agent-php-8.3:latest'
|
||||||
registryCredentialsId "ecr:ap-southeast-1:aws-ec2-instance-iam-role"
|
registryCredentialsId "ecr:ap-southeast-1:aws-ec2-instance-iam-role"
|
||||||
registryUrl "https://303644228504.dkr.ecr.ap-southeast-1.amazonaws.com"
|
registryUrl "https://303644228504.dkr.ecr.ap-southeast-1.amazonaws.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
HOME = '.'
|
HOME = '.'
|
||||||
DB_CONNECTION = 'mysql'
|
// DB_CONNECTION = 'mysql'
|
||||||
DB_DATABASE = 'portal_development'
|
// DB_DATABASE = 'portal_development'
|
||||||
APP_ENV = 'testing'
|
// APP_ENV = 'testing'
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Download source code from Git') {
|
stage('Download source code from Git') {
|
||||||
@@ -31,6 +31,7 @@ pipeline {
|
|||||||
case "vapor/production":
|
case "vapor/production":
|
||||||
case "vapor/staging":
|
case "vapor/staging":
|
||||||
case "vapor/development":
|
case "vapor/development":
|
||||||
|
case "vapor/test":
|
||||||
git(
|
git(
|
||||||
url: 'https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git',
|
url: 'https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git',
|
||||||
credentialsId: 'gitlab-jenkins-localhost',
|
credentialsId: 'gitlab-jenkins-localhost',
|
||||||
@@ -61,18 +62,45 @@ pipeline {
|
|||||||
|
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
steps {
|
steps {
|
||||||
//sh 'vendor/bin/phpunit tests/Unit'
|
// sh 'vendor/bin/phpunit tests/Unit'
|
||||||
withCredentials([
|
// withCredentials([
|
||||||
usernamePassword(
|
// usernamePassword(
|
||||||
credentialsId: 'shipping-portal-dev-db-credential',
|
// credentialsId: 'shipping-portal-dev-db-credential',
|
||||||
usernameVariable: 'DB_USERNAME',
|
// usernameVariable: 'DB_USERNAME',
|
||||||
passwordVariable: 'DB_PASSWORD'
|
// passwordVariable: 'DB_PASSWORD'
|
||||||
),
|
// ),
|
||||||
string(credentialsId: 'shipping-portal-dev-db-host', variable: 'DB_HOST')
|
// string(credentialsId: 'shipping-portal-dev-db-host', variable: 'DB_HOST')
|
||||||
]) {
|
// ]) {
|
||||||
// sh 'vendor/bin/phpunit --filter ListOrderTrackingLogicTest'
|
// sh 'vendor/bin/phpunit --filter ListOrderTrackingLogicTest'
|
||||||
}
|
// }
|
||||||
script{
|
sh '''
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export APP_ENV=testing
|
||||||
|
# export APP_KEY=$(php -r "echo 'base64:'.base64_encode(random_bytes(32));")
|
||||||
|
# export JWT_SECRET=$(php -r "echo bin2hex(random_bytes(32));")
|
||||||
|
|
||||||
|
# Show which PHP binary is used
|
||||||
|
which php
|
||||||
|
php -v
|
||||||
|
|
||||||
|
# List PHP modules to confirm pdo_mysql
|
||||||
|
php -m | grep pdo_mysql || echo "pdo_mysql not loaded"
|
||||||
|
|
||||||
|
# Show DB environment variables
|
||||||
|
echo "DB_CONNECTION=$DB_CONNECTION"
|
||||||
|
echo "DB_HOST=$DB_HOST"
|
||||||
|
echo "DB_PORT=$DB_PORT"
|
||||||
|
echo "DB_DATABASE=$DB_DATABASE"
|
||||||
|
echo "DB_USERNAME=$DB_USERNAME"
|
||||||
|
# Do NOT echo password in logs
|
||||||
|
|
||||||
|
php artisan migrate:fresh --force
|
||||||
|
|
||||||
|
vendor/bin/phpunit -c phpunit.ci.xml --group ok_to_run
|
||||||
|
|
||||||
|
'''
|
||||||
|
script {
|
||||||
currentBuild.description = 'Step 4 of 6 Completed'
|
currentBuild.description = 'Step 4 of 6 Completed'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,6 +122,9 @@ pipeline {
|
|||||||
case "vapor/development":
|
case "vapor/development":
|
||||||
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
|
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
|
||||||
break
|
break
|
||||||
|
case "vapor/test":
|
||||||
|
sh "vendor/bin/vapor deploy test --message='${gitCommitMessage}'"
|
||||||
|
break
|
||||||
case "origin/dillon/34-jenkins-vapor":
|
case "origin/dillon/34-jenkins-vapor":
|
||||||
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
|
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -19,22 +19,29 @@ abstract class AbstractGetRecord
|
|||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
private function getQueryFilters(){
|
private function getQueryFilters()
|
||||||
|
{
|
||||||
return $this->filters->except(self::DECORATION_FILTERS);
|
return $this->filters->except(self::DECORATION_FILTERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getDecorationFilters(){
|
public function getDecorationFilters()
|
||||||
|
{
|
||||||
return $this->filters->only(self::DECORATION_FILTERS);
|
return $this->filters->only(self::DECORATION_FILTERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null|string $json
|
* @param null|string|array $json
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function deserializeFilters(?string $json): array {
|
public function deserializeFilters($json): array
|
||||||
|
{
|
||||||
|
if (is_array($json)) {
|
||||||
|
return $json;
|
||||||
|
}
|
||||||
|
|
||||||
return $json !== null ? collect(json_decode($json))->toArray() : [];
|
return $json !== null ? collect(json_decode($json))->toArray() : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +57,8 @@ abstract class AbstractGetRecord
|
|||||||
* @param array $filters
|
* @param array $filters
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handler(array $filters, array $params = []){
|
public function handler(array $filters, array $params = [])
|
||||||
|
{
|
||||||
$this->filters = collect($filters);
|
$this->filters = collect($filters);
|
||||||
return $this->getResults($this->applyFiltersToQuery(), $params);
|
return $this->getResults($this->applyFiltersToQuery(), $params);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ interface Steppable
|
|||||||
|
|
||||||
public function steps(): morphMany;
|
public function steps(): morphMany;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ use App\Models\User;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Tymon\JWTAuth\JWT;
|
use Tymon\JWTAuth\JWT;
|
||||||
|
|
||||||
class GeneratesAuthenticationToken {
|
class GeneratesAuthenticationToken
|
||||||
|
{
|
||||||
|
|
||||||
/** @var JWT */
|
/** @var JWT */
|
||||||
private $builder;
|
private $builder;
|
||||||
@@ -21,7 +22,8 @@ class GeneratesAuthenticationToken {
|
|||||||
* GeneratesAuthenticationToken constructor.
|
* GeneratesAuthenticationToken constructor.
|
||||||
* @param JWT $builder
|
* @param JWT $builder
|
||||||
*/
|
*/
|
||||||
public function __construct(JWT $builder) {
|
public function __construct(JWT $builder)
|
||||||
|
{
|
||||||
$this->builder = $builder;
|
$this->builder = $builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,15 +33,16 @@ class GeneratesAuthenticationToken {
|
|||||||
* @param bool $rememberUser
|
* @param bool $rememberUser
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function execute(User $user, bool $rememberUser = false): string {
|
public function execute(User $user, bool $rememberUser = false): string
|
||||||
|
{
|
||||||
|
|
||||||
$this->builder->manager()->setBlacklistEnabled(false);
|
$this->builder->manager()->setBlacklistEnabled(false);
|
||||||
|
|
||||||
// generate token for the customer
|
// generate token for the customer
|
||||||
$this->builder->factory()->setTTL(Carbon::now()->addDay()->timestamp);
|
$this->builder->factory()->setTTL(525600); // 1 year
|
||||||
|
|
||||||
if ($rememberUser === true) {
|
if ($rememberUser === true) {
|
||||||
$this->builder->factory()->setTTL(Carbon::now()->addWeek()->timestamp);
|
$this->builder->factory()->setTTL(525600); // 1 year
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the claim based on the object
|
// set the claim based on the object
|
||||||
@@ -52,7 +55,8 @@ class GeneratesAuthenticationToken {
|
|||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
private function setTokenClaims(User $user): void {
|
private function setTokenClaims(User $user): void
|
||||||
|
{
|
||||||
|
|
||||||
$claims = [
|
$claims = [
|
||||||
'id' => $user->id,
|
'id' => $user->id,
|
||||||
@@ -62,7 +66,7 @@ class GeneratesAuthenticationToken {
|
|||||||
'status' => $user->status
|
'status' => $user->status
|
||||||
];
|
];
|
||||||
|
|
||||||
if($user->type === RoleTypes::USER) {
|
if ($user->type === RoleTypes::USER) {
|
||||||
|
|
||||||
/** @var Company $companyModule */
|
/** @var Company $companyModule */
|
||||||
$companyModule = $user->companyModule()->first();
|
$companyModule = $user->companyModule()->first();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Accounts\Standards\Validators;
|
|||||||
|
|
||||||
use App\Classes\General\Abstracts\AbstractValidation;
|
use App\Classes\General\Abstracts\AbstractValidation;
|
||||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserObject;
|
use App\Classes\Modules\Accounts\DataTransferObjects\UserObject;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class UserCreateValidation extends AbstractValidation
|
class UserCreateValidation extends AbstractValidation
|
||||||
{
|
{
|
||||||
@@ -29,7 +30,7 @@ class UserCreateValidation extends AbstractValidation
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'email' => 'required|unique:users',
|
'email' => ['required', Rule::unique('users')],
|
||||||
'password' => 'required',
|
'password' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Accounts\Standards\Validators;
|
|||||||
|
|
||||||
use App\Classes\General\Abstracts\AbstractValidation;
|
use App\Classes\General\Abstracts\AbstractValidation;
|
||||||
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
|
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class UserRegistrationValidation extends AbstractValidation
|
class UserRegistrationValidation extends AbstractValidation
|
||||||
{
|
{
|
||||||
@@ -32,7 +33,7 @@ class UserRegistrationValidation extends AbstractValidation
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'email' => 'required|email|max:255|unique:users,email',
|
'email' => ['required', 'email', 'max:255', Rule::unique('users', 'email')],
|
||||||
'password' => 'required|min:6|confirmed',
|
'password' => 'required|min:6|confirmed',
|
||||||
'type' => 'required',
|
'type' => 'required',
|
||||||
'status' => 'required'
|
'status' => 'required'
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ namespace App\Classes\Modules\Documents\DataTransferObjects;
|
|||||||
use App\Classes\Exceptions\MalformedRequestException;
|
use App\Classes\Exceptions\MalformedRequestException;
|
||||||
use App\Classes\General\Interfaces\DataTransferObject;
|
use App\Classes\General\Interfaces\DataTransferObject;
|
||||||
use App\Classes\ValueObjects\Constants\FileType;
|
use App\Classes\ValueObjects\Constants\FileType;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Intervention\Image\ImageManager;
|
use Intervention\Image\ImageManager;
|
||||||
|
use Intervention\Image\Drivers\Gd\Driver;
|
||||||
|
|
||||||
class FileObject implements DataTransferObject
|
class FileObject implements DataTransferObject
|
||||||
{
|
{
|
||||||
@@ -28,7 +30,13 @@ class FileObject implements DataTransferObject
|
|||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData()
|
||||||
{
|
{
|
||||||
return in_array($this->getExtension(), ['pdf', 'excel']) ? $this->data : (new imageManager())->make($this->data);
|
// intervention/image v2: old
|
||||||
|
// return in_array($this->getExtension(), ['pdf', 'excel']) ? $this->data : (new imageManager())->make($this->data);
|
||||||
|
|
||||||
|
// intervention/image v3: new
|
||||||
|
return in_array($this->getExtension(), ['pdf', 'excel'])
|
||||||
|
? $this->data
|
||||||
|
: (new ImageManager(new Driver()))->read($this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,9 +74,10 @@ class FileObject implements DataTransferObject
|
|||||||
*/
|
*/
|
||||||
public function getDecodedData(): string
|
public function getDecodedData(): string
|
||||||
{
|
{
|
||||||
|
// intervention/image v3: Use encode()->toDataUri() instead of encode('data-url')->encoded
|
||||||
return in_array($this->getExtension(), ['pdf', 'excel']) ?
|
return in_array($this->getExtension(), ['pdf', 'excel']) ?
|
||||||
base64_decode((explode('base64,', $this->getData()))[1]):
|
base64_decode((explode('base64,', $this->getData()))[1]):
|
||||||
$this->getData()->encode('data-url')->encoded;
|
$this->getData()->encode()->toDataUri();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -66,17 +66,22 @@ class ConvertsBase64ToFile
|
|||||||
$suffix = $size !== 'original' ? '_'.$size : '';
|
$suffix = $size !== 'original' ? '_'.$size : '';
|
||||||
|
|
||||||
if($size !== 'original') {
|
if($size !== 'original') {
|
||||||
$thumbnail = $file->getData()->widen($value, function ($constraint) {
|
|
||||||
|
|
||||||
$constraint->upsize();
|
// intervention/image v2: old
|
||||||
|
// $thumbnail = $file->getData()->widen($value, function ($constraint) {
|
||||||
|
// $constraint->upsize();
|
||||||
|
// })->heighten($value, function ($constraint) {
|
||||||
|
// $constraint->upsize();
|
||||||
|
// });
|
||||||
|
// $file->setData($thumbnail->encode('data-url')->encoded);
|
||||||
|
|
||||||
})->heighten($value, function ($constraint) {
|
|
||||||
|
|
||||||
$constraint->upsize();
|
// intervention/image v3: Use scaleDown() instead of widen()/heighten()
|
||||||
|
// scaleDown() maintains aspect ratio and prevents upsizing by default
|
||||||
|
$thumbnail = $file->getData()->scaleDown(width: $value, height: $value);
|
||||||
|
|
||||||
});
|
// intervention/image v3: Use encode()->toDataUri() instead of encode('data-url')->encoded
|
||||||
|
$file->setData($thumbnail->encode()->toDataUri());
|
||||||
$file->setData($thumbnail->encode('data-url')->encoded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,14 +19,18 @@ class CreatesFiles extends AbstractUpdateRelationshipRecord
|
|||||||
{
|
{
|
||||||
$models = [];
|
$models = [];
|
||||||
|
|
||||||
|
// foreach ($object->getFiles() as $file) {
|
||||||
|
// $model = new File(['file' => $file]);
|
||||||
|
// $models[] = $this->handler($document->files(), $model);
|
||||||
|
// }
|
||||||
|
|
||||||
foreach ($object->getFiles() as $file) {
|
foreach ($object->getFiles() as $file) {
|
||||||
|
$fileData = is_string($file) ? json_decode($file, true) : $file;
|
||||||
$model = new File(['file' => $file]);
|
$model = new File(['file' => $fileData]);
|
||||||
$models[] = $this->handler($document->files(), $model);
|
$models[] = $this->handler($document->files(), $model);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $models;
|
return $models;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ use App\Classes\Modules\OrderSteps\DataTransferObjects\StepsObject;
|
|||||||
use App\Classes\Modules\OrderSteps\Services\UpdatesOrderSteps;
|
use App\Classes\Modules\OrderSteps\Services\UpdatesOrderSteps;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This class uses incorrect StepsObject instantiation (9 parameters instead of 4)
|
||||||
|
* FIXME: Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
|
*/
|
||||||
class ConfirmOrderProcessor
|
class ConfirmOrderProcessor
|
||||||
{
|
{
|
||||||
private $canConfirmOrder;
|
private $canConfirmOrder;
|
||||||
@@ -42,6 +46,8 @@ class ConfirmOrderProcessor
|
|||||||
//Only Processing Step is created at this point
|
//Only Processing Step is created at this point
|
||||||
$orderStep = $order->orderSteps[0];
|
$orderStep = $order->orderSteps[0];
|
||||||
|
|
||||||
|
// FIXME: Incorrect StepsObject instantiation - uses 9 parameters instead of correct 4-parameter pattern
|
||||||
|
// Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
$orderStepObject = new StepsObject(
|
$orderStepObject = new StepsObject(
|
||||||
0,
|
0,
|
||||||
$orderStep->reference,
|
$orderStep->reference,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Orders\Standards\Validators;
|
|||||||
|
|
||||||
use App\Classes\General\Abstracts\AbstractValidation;
|
use App\Classes\General\Abstracts\AbstractValidation;
|
||||||
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class ConfirmOrderValidation extends AbstractValidation
|
class ConfirmOrderValidation extends AbstractValidation
|
||||||
{
|
{
|
||||||
@@ -26,7 +27,7 @@ class ConfirmOrderValidation extends AbstractValidation
|
|||||||
{
|
{
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => 'required|exists:orders,id'
|
'id' => ['required', Rule::exists('orders', 'id')]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Orders\Standards\Validators;
|
|||||||
|
|
||||||
use App\Classes\General\Abstracts\AbstractValidation;
|
use App\Classes\General\Abstracts\AbstractValidation;
|
||||||
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class OrderRoleValidation extends AbstractValidation
|
class OrderRoleValidation extends AbstractValidation
|
||||||
{
|
{
|
||||||
@@ -28,8 +29,8 @@ class OrderRoleValidation extends AbstractValidation
|
|||||||
protected function rules(?string $type = 'POST'): array
|
protected function rules(?string $type = 'POST'): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'order_id' => 'required|exists:orders,id',
|
'order_id' => ['required', Rule::exists('orders', 'id')],
|
||||||
'company_module_id' => 'required|exists:company_modules,id',
|
'company_module_id' => ['required', Rule::exists('company_modules', 'id')],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-7
@@ -1,15 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Classes\Modules\PackingList\Packages\Items\ControllersLogic;
|
namespace App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items;
|
||||||
|
|
||||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||||
use App\Classes\Modules\PackingLists\Services\Packages\Items\CreatesItem;
|
use App\Classes\Modules\PackingLists\Services\Packages\Items\CreatesItem;
|
||||||
use App\Classes\Modules\Orders\Services\FetchesOrder;
|
use App\Classes\Modules\Orders\Services\FetchesOrder;
|
||||||
use App\Classes\Modules\PackingLists\Standards\Rules\Packages\Items\CanCreatePackageItem;
|
|
||||||
use App\Classes\Modules\PackingLists\DataTransferObjects\ItemObject;
|
|
||||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||||
use App\Classes\Modules\Packages\Services\FetchesPackage;
|
use App\Classes\Modules\PackingLists\DataTransferObjects\ItemObject;
|
||||||
|
use App\Classes\Modules\PackingLists\Standards\Rules\Packages\CanCreatePackageItem;
|
||||||
|
use App\Classes\Modules\PackingLists\Services\Packages\FetchesPackage;
|
||||||
use App\Http\Resources\ItemResource;
|
use App\Http\Resources\ItemResource;
|
||||||
use ErrorException;
|
use ErrorException;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
@@ -21,7 +21,8 @@ class CreatePackageItemLogic extends AbstractControllerLogic
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function notification():array {
|
protected function notification(): array
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
'title' => 'Created PackageItem',
|
'title' => 'Created PackageItem',
|
||||||
'message' => 'You have successfully created a new PackageItem'
|
'message' => 'You have successfully created a new PackageItem'
|
||||||
@@ -57,7 +58,7 @@ class CreatePackageItemLogic extends AbstractControllerLogic
|
|||||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||||
*/
|
*/
|
||||||
public function logic(Request $request) : JsonResponse
|
public function logic(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
|
|
||||||
$package = $this->fetchesPackage->execute(['id' => $request->input('package_id')]);
|
$package = $this->fetchesPackage->execute(['id' => $request->input('package_id')]);
|
||||||
@@ -73,7 +74,8 @@ class CreatePackageItemLogic extends AbstractControllerLogic
|
|||||||
$request->input('uom'),
|
$request->input('uom'),
|
||||||
$request->input('price'),
|
$request->input('price'),
|
||||||
$request->input('total'),
|
$request->input('total'),
|
||||||
ApprovalStatus::PENDING_SUBMISSION);
|
ApprovalStatus::PENDING_SUBMISSION
|
||||||
|
);
|
||||||
|
|
||||||
$this->canCreatePackageItem->passes($object);
|
$this->canCreatePackageItem->passes($object);
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Classes\Modules\PackageItems\ControllersLogic;
|
namespace App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items;
|
||||||
|
|
||||||
|
|
||||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||||
@@ -16,7 +16,8 @@ class DeletePackageItemLogic extends AbstractControllerLogic
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function notification():array {
|
protected function notification(): array
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
'title' => 'Deleted PackageItem',
|
'title' => 'Deleted PackageItem',
|
||||||
'message' => 'You have successfully deleted a PackageItem'
|
'message' => 'You have successfully deleted a PackageItem'
|
||||||
@@ -31,7 +32,7 @@ class DeletePackageItemLogic extends AbstractControllerLogic
|
|||||||
private $deletesPackageItem;
|
private $deletesPackageItem;
|
||||||
|
|
||||||
/** @var FetchesItem */
|
/** @var FetchesItem */
|
||||||
private $fetchesPackageItem;
|
private $fetchesPackageItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DeletePackageItemControllersLogic constructor.
|
* DeletePackageItemControllersLogic constructor.
|
||||||
@@ -52,7 +53,7 @@ class DeletePackageItemLogic extends AbstractControllerLogic
|
|||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws ErrorException
|
* @throws ErrorException
|
||||||
*/
|
*/
|
||||||
public function logic(Request $request) : JsonResponse
|
public function logic(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ class DeletePackageItemLogic extends AbstractControllerLogic
|
|||||||
|
|
||||||
return $this->response([]);
|
return $this->response([]);
|
||||||
|
|
||||||
} catch (\Exception $exception){
|
} catch (\Exception $exception) {
|
||||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Classes\Modules\PackageItems\ControllersLogic;
|
namespace App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items;
|
||||||
|
|
||||||
|
|
||||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||||
@@ -17,7 +17,8 @@ class FetchPackageItemLogic extends AbstractControllerLogic
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function notification():array {
|
protected function notification(): array
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
'title' => 'Retrieved PackageItem',
|
'title' => 'Retrieved PackageItem',
|
||||||
'message' => 'You have successfully retrieved a PackageItem'
|
'message' => 'You have successfully retrieved a PackageItem'
|
||||||
@@ -47,7 +48,7 @@ class FetchPackageItemLogic extends AbstractControllerLogic
|
|||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws ErrorException
|
* @throws ErrorException
|
||||||
*/
|
*/
|
||||||
public function logic(Request $request) : JsonResponse
|
public function logic(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ class FetchPackageItemLogic extends AbstractControllerLogic
|
|||||||
|
|
||||||
return $this->resourceResponse(new ItemResource($query));
|
return $this->resourceResponse(new ItemResource($query));
|
||||||
|
|
||||||
} catch (\Exception $exception){
|
} catch (\Exception $exception) {
|
||||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Classes\Modules\PackageItems\ControllersLogic;
|
namespace App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items;
|
||||||
|
|
||||||
|
|
||||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||||
@@ -17,7 +17,8 @@ class ListPackageItemsLogic extends AbstractControllerLogic
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function notification():array {
|
protected function notification(): array
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
'title' => 'Retrieved PackageItems',
|
'title' => 'Retrieved PackageItems',
|
||||||
'message' => 'You have successfully retrieved a list of PackageItems'
|
'message' => 'You have successfully retrieved a list of PackageItems'
|
||||||
@@ -47,7 +48,7 @@ class ListPackageItemsLogic extends AbstractControllerLogic
|
|||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws ErrorException
|
* @throws ErrorException
|
||||||
*/
|
*/
|
||||||
public function logic(Request $request) : JsonResponse
|
public function logic(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ class ListPackageItemsLogic extends AbstractControllerLogic
|
|||||||
|
|
||||||
return $this->collectionResponse(ItemResource::collection($query));
|
return $this->collectionResponse(ItemResource::collection($query));
|
||||||
|
|
||||||
} catch (\Exception $exception){
|
} catch (\Exception $exception) {
|
||||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Classes\Modules\PackageItems\ControllersLogic;
|
namespace App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items;
|
||||||
|
|
||||||
|
|
||||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||||
@@ -19,7 +19,8 @@ class UpdatePackageItemLogic extends AbstractControllerLogic
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function notification():array {
|
protected function notification(): array
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
'title' => 'Updated PackageItem',
|
'title' => 'Updated PackageItem',
|
||||||
'message' => 'You have successfully updated the PackageItem'
|
'message' => 'You have successfully updated the PackageItem'
|
||||||
@@ -54,7 +55,7 @@ class UpdatePackageItemLogic extends AbstractControllerLogic
|
|||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws ErrorException
|
* @throws ErrorException
|
||||||
*/
|
*/
|
||||||
public function logic(Request $request) : JsonResponse
|
public function logic(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
$packageItem = $this->fetchesPackageItem->execute(['id' => $request->route('id')]);
|
$packageItem = $this->fetchesPackageItem->execute(['id' => $request->route('id')]);
|
||||||
|
|
||||||
@@ -67,7 +68,8 @@ class UpdatePackageItemLogic extends AbstractControllerLogic
|
|||||||
$request->input('uom'),
|
$request->input('uom'),
|
||||||
$request->input('price'),
|
$request->input('price'),
|
||||||
$request->input('total'),
|
$request->input('total'),
|
||||||
$request->input('status'));
|
$request->input('status')
|
||||||
|
);
|
||||||
|
|
||||||
$this->canUpdatePackageItem->passes($object);
|
$this->canUpdatePackageItem->passes($object);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
|||||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||||
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
|
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
|
||||||
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
|
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
|
||||||
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
|
|
||||||
use App\Classes\Modules\Steps\Services\CreatesStep;
|
use App\Classes\Modules\Steps\Services\CreatesStep;
|
||||||
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
||||||
use App\Classes\Modules\Transports\Services\CreatesTransport;
|
use App\Classes\Modules\Transports\Services\CreatesTransport;
|
||||||
|
|||||||
-1
@@ -13,7 +13,6 @@ use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
|||||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||||
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
|
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
|
||||||
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
|
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
|
||||||
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
|
|
||||||
use App\Classes\Modules\Steps\Services\CreatesStep;
|
use App\Classes\Modules\Steps\Services\CreatesStep;
|
||||||
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
||||||
use App\Classes\Modules\Transports\Services\CreatesTransport;
|
use App\Classes\Modules\Transports\Services\CreatesTransport;
|
||||||
|
|||||||
+13
-6
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Classes\Modules\PackingList\Processors;
|
namespace App\Classes\Modules\PackingLists\Processors;
|
||||||
|
|
||||||
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
||||||
use App\Classes\Modules\Orders\Processors\UpdatesOrderCurrentStepProcessor;
|
use App\Classes\Modules\Orders\Processors\UpdatesOrderCurrentStepProcessor;
|
||||||
@@ -21,9 +21,13 @@ use App\Models\Step;
|
|||||||
use App\Classes\Jobs\UnityLogin;
|
use App\Classes\Jobs\UnityLogin;
|
||||||
use Config;
|
use Config;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use App\Classes\General\Interfaces\Steppable;
|
||||||
use function PHPSTORM_META\map;
|
use function PHPSTORM_META\map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This class uses incorrect StepsObject instantiation (5 parameters instead of 4)
|
||||||
|
* FIXME: Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
|
*/
|
||||||
class GenerateShippingOrderStepsProcessor
|
class GenerateShippingOrderStepsProcessor
|
||||||
{
|
{
|
||||||
/** @var CreatesManySteps */
|
/** @var CreatesManySteps */
|
||||||
@@ -44,13 +48,16 @@ class GenerateShippingOrderStepsProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function execute(Steppable $owner, CompanyModule $appointee, array $contract_obligation_list = []){
|
public function execute(Steppable $owner, CompanyModule $appointee, array $contract_obligation_list = [])
|
||||||
|
{
|
||||||
|
|
||||||
$obligations = $contract_obligation_list;
|
$obligations = $contract_obligation_list;
|
||||||
|
|
||||||
$this->createsManyStep->execute($owner, array_map(function($obligation) use ($appointee) {
|
$this->createsManyStep->execute($owner, array_map(function ($obligation) use ($appointee) {
|
||||||
return new StepsObject($appointee->id, $obligation->name,true, $step->sequence??0, 0,0, null,0, $step->hash_id);
|
// FIXME: Incorrect StepsObject instantiation - uses 5 parameters instead of correct 4-parameter pattern
|
||||||
}, $obligations));
|
// Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
|
return new StepsObject($appointee->id, $obligation->name, true, $obligation->sequence ?? 0, $obligation->hash_id ?? null);
|
||||||
|
}, $obligations));
|
||||||
|
|
||||||
$this->updateStepProcessors->execute(OrderSteps::PROCESSING);
|
$this->updateStepProcessors->execute(OrderSteps::PROCESSING);
|
||||||
|
|
||||||
|
|||||||
-1
@@ -10,7 +10,6 @@ use App\Classes\Modules\Orders\Services\FetchesOrder;
|
|||||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
|
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
|
||||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||||
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
|
|
||||||
// use App\Classes\Modules\Steps\Services\CreatesStep;
|
// use App\Classes\Modules\Steps\Services\CreatesStep;
|
||||||
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
||||||
// use App\Classes\Modules\Transports\Services\CreatesTransport;
|
// use App\Classes\Modules\Transports\Services\CreatesTransport;
|
||||||
|
|||||||
@@ -225,7 +225,6 @@ class FetchByTrakingNoYdPortalV2Processor
|
|||||||
Log::info('result (json_encoded): '.json_encode($result));
|
Log::info('result (json_encoded): '.json_encode($result));
|
||||||
// $content = $result['choices'][0]['message']['content'] ?? null;
|
// $content = $result['choices'][0]['message']['content'] ?? null;
|
||||||
$content = $result['content'][0]['text'] ?? '[]';
|
$content = $result['content'][0]['text'] ?? '[]';
|
||||||
|
|
||||||
Log::info('raw ETA/ETD content: ' . $content);
|
Log::info('raw ETA/ETD content: ' . $content);
|
||||||
|
|
||||||
// Remove markdown code fences if they exist
|
// Remove markdown code fences if they exist
|
||||||
|
|||||||
-1
@@ -18,7 +18,6 @@ use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
|||||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||||
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
|
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
|
||||||
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
|
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
|
||||||
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
|
|
||||||
use App\Classes\Modules\Steps\Services\CreatesStep;
|
use App\Classes\Modules\Steps\Services\CreatesStep;
|
||||||
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
||||||
use App\Classes\Modules\Transports\Services\CreatesTransport;
|
use App\Classes\Modules\Transports\Services\CreatesTransport;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Classes\Modules\PackingLists\Services;
|
namespace App\Classes\Modules\PackingLists\Services\Packages\Items;
|
||||||
|
|
||||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||||
use App\Classes\Modules\PackingLists\DataTransferObjects\ItemObject;
|
use App\Classes\Modules\PackingLists\DataTransferObjects\ItemObject;
|
||||||
@@ -8,7 +8,8 @@ use App\Models\Item;
|
|||||||
|
|
||||||
class UpdatesItem extends AbstractUpdateRecord
|
class UpdatesItem extends AbstractUpdateRecord
|
||||||
{
|
{
|
||||||
public function execute(Item $model, ItemObject $object) {
|
public function execute(Item $model, ItemObject $object)
|
||||||
|
{
|
||||||
|
|
||||||
$model->name = $object->getName();
|
$model->name = $object->getName();
|
||||||
$model->reference = $object->getReference();
|
$model->reference = $object->getReference();
|
||||||
|
|||||||
@@ -6,11 +6,17 @@ class AddItemToConstantValueArray
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $array
|
* @param array|string|null $array
|
||||||
* @param $item
|
* @param $item
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function execute($array, $item): array {
|
public function execute($array, $item): array {
|
||||||
|
// PHP 8.3: Ensure $array is always an array, even if JSON cast fails
|
||||||
|
// Handle cases where value might be empty string, null, or invalid JSON
|
||||||
|
if (!is_array($array)) {
|
||||||
|
$array = [];
|
||||||
|
}
|
||||||
|
|
||||||
$array[] = $item;
|
$array[] = $item;
|
||||||
sort($array);
|
sort($array);
|
||||||
return $array;
|
return $array;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class CreatesConstant extends AbstractUpdateRelationshipRecord
|
|||||||
{
|
{
|
||||||
$model = new SegmentConstant();
|
$model = new SegmentConstant();
|
||||||
$model->reference = $object->getReference();
|
$model->reference = $object->getReference();
|
||||||
$model->value = json_encode($object->getValue());
|
$model->value = $object->getValue();
|
||||||
|
|
||||||
return $this->handler($segment->constants(), $model);
|
return $this->handler($segment->constants(), $model);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,17 @@ class RemoveItemFromConstantValueArray
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $array
|
* @param array|string|null $array
|
||||||
* @param $item
|
* @param $item
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function execute($array, $item): array {
|
public function execute($array, $item): array {
|
||||||
|
// PHP 8.3: Ensure $array is always an array, even if JSON cast fails
|
||||||
|
// Handle cases where value might be empty string, null, or invalid JSON
|
||||||
|
if (!is_array($array)) {
|
||||||
|
$array = [];
|
||||||
|
}
|
||||||
|
|
||||||
foreach($array as $key => $value){
|
foreach($array as $key => $value){
|
||||||
if($array[$key] == $item){
|
if($array[$key] == $item){
|
||||||
unset($array[$key]);
|
unset($array[$key]);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class UpdatesConstant extends AbstractUpdateRecord
|
|||||||
public function execute(SegmentConstant $model, ConstantObject $object)
|
public function execute(SegmentConstant $model, ConstantObject $object)
|
||||||
{
|
{
|
||||||
$model->reference = $object->getReference();
|
$model->reference = $object->getReference();
|
||||||
$model->value = json_encode($object->getValue());
|
$model->value = $object->getValue();
|
||||||
|
|
||||||
return $this->handler($model);
|
return $this->handler($model);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use App\Classes\ValueObjects\Constants\OrderStatus;
|
|||||||
use App\Classes\ValueObjects\Constants\Steps;
|
use App\Classes\ValueObjects\Constants\Steps;
|
||||||
use App\Classes\ValueObjects\Constants\OrderType;
|
use App\Classes\ValueObjects\Constants\OrderType;
|
||||||
use App\Http\Resources\StepResource;
|
use App\Http\Resources\StepResource;
|
||||||
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
|
|
||||||
use App\Classes\Modules\Steps\Services\FetchesSteps;
|
use App\Classes\Modules\Steps\Services\FetchesSteps;
|
||||||
use App\Classes\Modules\Steps\Processors\CompletesStepProcessor;
|
use App\Classes\Modules\Steps\Processors\CompletesStepProcessor;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ use App\Classes\Modules\Orders\Processors\UpdatesOrderCurrentStepProcessor;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This class uses incorrect StepsObject instantiation (9 parameters instead of 4)
|
||||||
|
* FIXME: Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
|
*/
|
||||||
class CompletesStepProcessor
|
class CompletesStepProcessor
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -52,6 +56,8 @@ class CompletesStepProcessor
|
|||||||
|
|
||||||
//Unity Contract Obligation Completed Status = 3
|
//Unity Contract Obligation Completed Status = 3
|
||||||
if(isset($completed->status) && $completed->status == OrderStatus::COMPLETE){
|
if(isset($completed->status) && $completed->status == OrderStatus::COMPLETE){
|
||||||
|
// FIXME: Incorrect StepsObject instantiation - uses 9 parameters instead of correct 4-parameter pattern
|
||||||
|
// Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
$orderStepObject = new StepsObject(
|
$orderStepObject = new StepsObject(
|
||||||
$contractEntity->company_module_id,
|
$contractEntity->company_module_id,
|
||||||
$orderStep->reference,
|
$orderStep->reference,
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ use App\Models\Order;
|
|||||||
use App\Models\Step;
|
use App\Models\Step;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This class uses incorrect StepsObject instantiation (9 parameters instead of 4)
|
||||||
|
* FIXME: Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
|
*/
|
||||||
class CreateStepsProcessor
|
class CreateStepsProcessor
|
||||||
{
|
{
|
||||||
private $canCreateStep;
|
private $canCreateStep;
|
||||||
@@ -46,6 +50,8 @@ class CreateStepsProcessor
|
|||||||
*/
|
*/
|
||||||
public function execute(Order $order, string $currentStep, $appointee_id){
|
public function execute(Order $order, string $currentStep, $appointee_id){
|
||||||
|
|
||||||
|
// FIXME: Incorrect StepsObject instantiation - uses 9 parameters instead of correct 4-parameter pattern
|
||||||
|
// Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
$stepObject = new StepsObject( $appointee_id, $currentStep, true, 0, OrderStatus::PROCESSING, 0, null, 0, null);
|
$stepObject = new StepsObject( $appointee_id, $currentStep, true, 0, OrderStatus::PROCESSING, 0, null, 0, null);
|
||||||
|
|
||||||
$this->canCreateStep->passes($stepObject);
|
$this->canCreateStep->passes($stepObject);
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ use App\Classes\Jobs\UnityLogin;
|
|||||||
use Config;
|
use Config;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This class uses incorrect StepsObject instantiation (9 parameters instead of 4)
|
||||||
|
* FIXME: Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
|
*/
|
||||||
class GenerateStepsProcessor
|
class GenerateStepsProcessor
|
||||||
{
|
{
|
||||||
private $updatesOrderCurrentStep;
|
private $updatesOrderCurrentStep;
|
||||||
@@ -46,6 +49,8 @@ class GenerateStepsProcessor
|
|||||||
//TODO: Collect hash_id & search company module table for appointee id
|
//TODO: Collect hash_id & search company module table for appointee id
|
||||||
|
|
||||||
foreach($obligations as $step){
|
foreach($obligations as $step){
|
||||||
|
// FIXME: Incorrect StepsObject instantiation - uses 9 parameters instead of correct 4-parameter pattern
|
||||||
|
// Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
$orderSteps[] = new StepsObject(
|
$orderSteps[] = new StepsObject(
|
||||||
$orderRoles[0]->company_module_id,
|
$orderRoles[0]->company_module_id,
|
||||||
$step->name,
|
$step->name,
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ use App\Classes\ValueObjects\Constants\Steps;
|
|||||||
use App\Models\Order;
|
use App\Models\Order;
|
||||||
use App\Models\Step;
|
use App\Models\Step;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This class uses incorrect StepsObject instantiation (9 parameters instead of 4)
|
||||||
|
* FIXME: Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
|
*/
|
||||||
class UpdateStepsProcessor
|
class UpdateStepsProcessor
|
||||||
{
|
{
|
||||||
private $canUpdateStep;
|
private $canUpdateStep;
|
||||||
@@ -31,6 +35,8 @@ class UpdateStepsProcessor
|
|||||||
|
|
||||||
public function execute(string $currentStep){
|
public function execute(string $currentStep){
|
||||||
|
|
||||||
|
// FIXME: Incorrect StepsObject instantiation - uses 9 parameters instead of correct 4-parameter pattern
|
||||||
|
// Correct pattern: new StepsObject($appointee_id, $obligation->reference, $obligation->sequence, $obligation->hash_id)
|
||||||
$orderStepsObject = new StepsObject(0,$currentStep, 0, 0, 1, 1, null, 0, null);
|
$orderStepsObject = new StepsObject(0,$currentStep, 0, 0, 1, 1, null, 0, null);
|
||||||
|
|
||||||
$this->canUpdateStep->passes($orderStepsObject);
|
$this->canUpdateStep->passes($orderStepsObject);
|
||||||
|
|||||||
@@ -7,22 +7,30 @@ use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
|
|||||||
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
|
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
|
||||||
use App\Models\Step;
|
use App\Models\Step;
|
||||||
use App\Models\Order;
|
use App\Models\Order;
|
||||||
|
use App\Classes\General\Interfaces\Steppable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This class calls undefined methods on StepsObject (getPrimary, getHashId)
|
||||||
|
* FIXME: StepsObject only has: getAppointeeId(), getReference(), getSequence(), getObligationId()
|
||||||
|
*/
|
||||||
class CreatesManySteps extends AbstractUpdateRelationshipRecord
|
class CreatesManySteps extends AbstractUpdateRelationshipRecord
|
||||||
{
|
{
|
||||||
|
|
||||||
public function execute(Steppable $owner, array $orderSteps) {
|
public function execute(Steppable $owner, array $orderSteps)
|
||||||
|
{
|
||||||
|
|
||||||
$orderStepsModel=[];
|
$orderStepsModel = [];
|
||||||
foreach($orderSteps as $step){
|
foreach ($orderSteps as $step) {
|
||||||
$orderStepsModel[]=[
|
// FIXME: Calling undefined getter methods on StepsObject
|
||||||
|
// StepsObject only has: getAppointeeId(), getReference(), getSequence(), getObligationId()
|
||||||
|
$orderStepsModel[] = [
|
||||||
'appointee_id' => $step->getAppointeeId(),
|
'appointee_id' => $step->getAppointeeId(),
|
||||||
'reference' => $step->getReference(),
|
'reference' => $step->getReference(),
|
||||||
'primary' => $step->getPrimary(),
|
'primary' => $step->getPrimary(), // UNDEFINED METHOD
|
||||||
'sequence' => $step->getSequence(),
|
'sequence' => $step->getSequence(),
|
||||||
'status' => 0,
|
'status' => 0,
|
||||||
'contract_status' => 0,
|
'contract_status' => 0,
|
||||||
'unity_hash_id' => $step->getHashId(),
|
'unity_hash_id' => $step->getHashId(), // UNDEFINED METHOD
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,21 @@ use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
|||||||
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
|
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
|
||||||
use App\Models\Step;
|
use App\Models\Step;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This class calls undefined methods on StepsObject (getStatus, getContractStatus, getCompletedDate)
|
||||||
|
* FIXME: StepsObject only has: getAppointeeId(), getReference(), getSequence(), getObligationId()
|
||||||
|
*/
|
||||||
class UpdatesSteps extends AbstractUpdateRecord
|
class UpdatesSteps extends AbstractUpdateRecord
|
||||||
{
|
{
|
||||||
|
|
||||||
public function execute(Step $model, StepsObject $object) {
|
public function execute(Step $model, StepsObject $object) {
|
||||||
|
|
||||||
$model->status = $object->getStatus();
|
// FIXME: Calling undefined getter methods on StepsObject
|
||||||
$model->contract_status = $object->getContractStatus();
|
// StepsObject only has: getAppointeeId(), getReference(), getSequence(), getObligationId()
|
||||||
$model->complete_date = $object->getCompletedDate();
|
// The following methods DO NOT EXIST:
|
||||||
|
$model->status = $object->getStatus(); // UNDEFINED METHOD
|
||||||
|
$model->contract_status = $object->getContractStatus(); // UNDEFINED METHOD
|
||||||
|
$model->complete_date = $object->getCompletedDate(); // UNDEFINED METHOD
|
||||||
|
|
||||||
return $this->handler($model);
|
return $this->handler($model);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace App\Classes\Modules\Transports\Services;
|
|||||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||||
use App\Models\Transport;
|
use App\Models\Transport;
|
||||||
|
|
||||||
class updatesTransportStatus extends AbstractUpdateRecord
|
class UpdatesTransportStatus extends AbstractUpdateRecord
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +14,8 @@ class updatesTransportStatus extends AbstractUpdateRecord
|
|||||||
* @return \Illuminate\Database\Eloquent\Model
|
* @return \Illuminate\Database\Eloquent\Model
|
||||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||||
*/
|
*/
|
||||||
public function execute(Transport $model, int $status) {
|
public function execute(Transport $model, int $status)
|
||||||
|
{
|
||||||
|
|
||||||
$model->status = $status;
|
$model->status = $status;
|
||||||
|
|
||||||
|
|||||||
@@ -22,4 +22,8 @@ class SegmentConstants
|
|||||||
public const OUTSTATION_POSTCODE = 'OUTSTATION_POSTCODE';
|
public const OUTSTATION_POSTCODE = 'OUTSTATION_POSTCODE';
|
||||||
|
|
||||||
public const CUSTOMER_RATE = 'CUSTOMER_RATE';
|
public const CUSTOMER_RATE = 'CUSTOMER_RATE';
|
||||||
}
|
|
||||||
|
public const SERVICE_TYPE = 'SERVICE_TYPE'; //syntax fix, likely no longer used
|
||||||
|
|
||||||
|
public const CUSTOM_SERVICE_TYPE = 'CUSTOM_SERVICE_TYPE'; //syntax fix, likely no longer used
|
||||||
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class ProcessYDPortalDataV2Command extends Command
|
|||||||
$jobs1 = $this->fetchPackingListsFromYdPortalV2CommandJobs();
|
$jobs1 = $this->fetchPackingListsFromYdPortalV2CommandJobs();
|
||||||
$jobs2 = $this->fetchContainersYdPortalV3CommandJobs();
|
$jobs2 = $this->fetchContainersYdPortalV3CommandJobs();
|
||||||
$jobs3 = $this->fetchContainersUpdatesYdPortalV3CommandJob();
|
$jobs3 = $this->fetchContainersUpdatesYdPortalV3CommandJob();
|
||||||
$jobs4 = $this->fetchDeliveryUpdatesFromYdPortalV2CommandJobs();
|
// $jobs4 = $this->fetchDeliveryUpdatesFromYdPortalV2CommandJobs();
|
||||||
|
|
||||||
// The following job is intentionally excluded
|
// The following job is intentionally excluded
|
||||||
////$jobs5 = array_merge($jobs, $this->fetchOrderListsFromYdPortalV2CommandJob());
|
////$jobs5 = array_merge($jobs, $this->fetchOrderListsFromYdPortalV2CommandJob());
|
||||||
@@ -66,10 +66,10 @@ class ProcessYDPortalDataV2Command extends Command
|
|||||||
dispatch($job);
|
dispatch($job);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($jobs4 as $index => $job) {
|
// foreach ($jobs4 as $index => $job) {
|
||||||
$delayInSeconds = intdiv($index, 2);
|
// $delayInSeconds = intdiv($index, 2);
|
||||||
dispatch($job)->delay(now()->addSeconds($delayInSeconds));
|
// dispatch($job)->delay(now()->addSeconds($delayInSeconds));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private function fetchPackingListsFromYdPortalV2CommandJobs(){
|
private function fetchPackingListsFromYdPortalV2CommandJobs(){
|
||||||
|
|||||||
@@ -1,166 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console;
|
|
||||||
|
|
||||||
use App\Classes\Jobs\FetchContainersStatusUpdateFromVTPortalJob;
|
|
||||||
use App\Classes\Jobs\FetchDeliveryListFromVTPortalJob;
|
|
||||||
use App\Classes\Jobs\FetchLoadedContainersFromVTPortalJob;
|
|
||||||
use App\Classes\Jobs\FetchPackingListFromVTPortalJob;
|
|
||||||
use App\Classes\Jobs\FetchWarehouseReceiveListFromVTPortalJob;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
||||||
|
|
||||||
class Kernel extends ConsoleKernel
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The Artisan commands provided by your application.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $commands = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define the application's command schedule.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function schedule(Schedule $schedule)
|
|
||||||
{
|
|
||||||
//Commands Version 2: Laravel Vapor with AWS
|
|
||||||
$isEnabled = env('COMMANDS_V2_ENABLED', false);
|
|
||||||
if($isEnabled){
|
|
||||||
// $schedule->command('dummy-command')
|
|
||||||
// ->everyFiveMinutes()
|
|
||||||
// ->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('housekeeping-s3-files-command')
|
|
||||||
->dailyAt('01:00')
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('password-reset-token-expriration-check-command')
|
|
||||||
->everySixHours()
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('new-user-registration-expire-check-command')
|
|
||||||
->everySixHours()
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
if(env('APP_ENV') === 'production'){
|
|
||||||
$schedule->command('curl-vt-command')
|
|
||||||
->cron('0 8 * * *')
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
// $schedule->command('curl-yd-order-list-command')
|
|
||||||
// ->cron('0 9-18/3 * * *')
|
|
||||||
// ->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('process-yd-by-traking-no-data-command')
|
|
||||||
->cron('0 8,11,14,17 * * *')
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('process-yd-portal-data-command')
|
|
||||||
->cron('0 9,12,15,18 * * *') //->cron('0 9-18/3 * * *')
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('fix-packinglist-command')
|
|
||||||
->cron('30 9-18/3 * * *')
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('fix-duplicate-container-reference-command')
|
|
||||||
->cron('0 1 * * *')
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
// $schedule->command('invoice-generate-command')
|
|
||||||
// ->hourly()
|
|
||||||
// ->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('invoice-generate-command')
|
|
||||||
->cron('0 0-8,10-11,13-14,16-17,19-23 * * *')
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('billplz-failed-callback-fix-command')
|
|
||||||
->hourly()
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('check-storage-invoices-group-transactions-command')
|
|
||||||
->dailyAt('0:01')
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('permits-reminder-send-command')
|
|
||||||
->dailyAt('09:30')
|
|
||||||
->withoutOverlapping();
|
|
||||||
|
|
||||||
$schedule->command('process-delayed-jobs-command')
|
|
||||||
->everyFiveMinutes()
|
|
||||||
->withoutOverlapping();
|
|
||||||
}
|
|
||||||
else if (env('APP_ENV') === 'development'){
|
|
||||||
$schedule->command('process-delayed-jobs-command')
|
|
||||||
->everyTwoHours()
|
|
||||||
->withoutOverlapping();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Commands Version 1: Before AWS
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$schedule->command('command:curlVTCommand')
|
|
||||||
->cron('0 8 * * *')
|
|
||||||
->withoutOverlapping()
|
|
||||||
->appendOutputTo (storage_path().'/logs/curlvt.log');
|
|
||||||
|
|
||||||
$schedule->command('command:curlYdOrderListCommand')
|
|
||||||
->cron('0 9-18/3 * * *')
|
|
||||||
->withoutOverlapping()
|
|
||||||
->appendOutputTo (storage_path().'/logs/curlyd.log');
|
|
||||||
|
|
||||||
$schedule->command('fix-packinglist')
|
|
||||||
->cron('30 9-18/3 * * *')
|
|
||||||
->withoutOverlapping()
|
|
||||||
->appendOutputTo (storage_path().'/logs/fix_packinglist.log');
|
|
||||||
|
|
||||||
// $schedule->command('command:curlYdOrderListCommand')
|
|
||||||
// ->cron('0 9 * * *')
|
|
||||||
// ->withoutOverlapping()
|
|
||||||
// ->appendOutputTo (storage_path().'/logs/departure_email.log');
|
|
||||||
|
|
||||||
$schedule->command('fix-duplicate-container-reference')
|
|
||||||
->cron('0 1 * * *')
|
|
||||||
->withoutOverlapping()
|
|
||||||
->appendOutputTo (storage_path().'/logs/fix_duplicate_container_reference.log');
|
|
||||||
|
|
||||||
$schedule->command('invoice:generate')
|
|
||||||
->hourly()
|
|
||||||
->withoutOverlapping()
|
|
||||||
->appendOutputTo (storage_path().'/logs/auto_generate_invoice.log');
|
|
||||||
|
|
||||||
$schedule->command('billplz-failed-callback:fix')
|
|
||||||
->hourly()
|
|
||||||
->withoutOverlapping()
|
|
||||||
->appendOutputTo (storage_path().'/logs/fix_failed_callback_from_billplz.log');
|
|
||||||
|
|
||||||
$schedule->command('check-storage-invoices-group-transactions')
|
|
||||||
->dailyAt('0:01')
|
|
||||||
->withoutOverlapping()
|
|
||||||
->appendOutputTo(storage_path().'/logs/check_storage_invoices.log');
|
|
||||||
|
|
||||||
$schedule->command('permitsReminder:send')
|
|
||||||
->dailyAt('09:30')
|
|
||||||
->withoutOverlapping()
|
|
||||||
->appendOutputTo(storage_path().'/logs/permits-reminder-send.log');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the commands for the application.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function commands()
|
|
||||||
{
|
|
||||||
$this->load(__DIR__.'/Commands');
|
|
||||||
$this->load(__DIR__.'/Commands/V2');
|
|
||||||
|
|
||||||
require base_path('routes/console.php');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exceptions;
|
|
||||||
|
|
||||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
|
||||||
use App\Classes\ValueObjects\Response\ApiResponseObject;
|
|
||||||
use Illuminate\Auth\AuthenticationException;
|
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
|
||||||
use Illuminate\Foundation\Http\Exceptions\MaintenanceModeException;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A list of the exception types that are not reported.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $dontReport = [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of the inputs that are never flashed for validation exceptions.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $dontFlash = [
|
|
||||||
'password',
|
|
||||||
'password_confirmation',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Throwable $exception
|
|
||||||
* @throws Throwable
|
|
||||||
*/
|
|
||||||
public function report(Throwable $exception)
|
|
||||||
{
|
|
||||||
if (env('LOG_STACK_TRACE', false)) {
|
|
||||||
Log::error($exception->getMessage(), [
|
|
||||||
'exception' => $exception,
|
|
||||||
'stack_trace' => $exception->getTraceAsString(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::report($exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render an exception into an HTTP response.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param \Throwable $exception
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*
|
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
|
||||||
public function render($request, Throwable $exception)
|
|
||||||
{
|
|
||||||
if ($exception instanceof MaintenanceModeException) {
|
|
||||||
return response()
|
|
||||||
->view('pages.errors.maintenance');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($exception instanceof AuthenticationException) {
|
|
||||||
return (new ApiResponseObject('Authentication', 'To keep your account secure we need to re-validate your account', HttpStatus::ACCESS_UNAUTHORISED))->handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::render($request, $exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -19,33 +19,33 @@ class ExportArrivedParcelController extends Controller
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* ExportArrivedParcelController constructor.
|
* ExportArrivedParcelController constructor.
|
||||||
* @param Request $request
|
|
||||||
*/
|
*/
|
||||||
public function __construct(Request $request)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->middleware('auth.check');
|
$this->middleware('auth.check');
|
||||||
// $token = Auth::fromUser(User::find(1));
|
// $token = Auth::fromUser(User::find(1));
|
||||||
// $request->headers->set('Authorization', 'Bearer '.$token);
|
// $request->headers->set('Authorization', 'Bearer '.$token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function export(Request $request) {
|
public function export(Request $request)
|
||||||
|
{
|
||||||
$startDate = $request->query('start_date');
|
$startDate = $request->query('start_date');
|
||||||
$endDate = $request->query('end_date');
|
$endDate = $request->query('end_date');
|
||||||
|
|
||||||
$exportsPendingArrangementDeliveryList = new ExportsArrivedParcel($startDate, $endDate);
|
$exportsPendingArrangementDeliveryList = new ExportsArrivedParcel($startDate, $endDate);
|
||||||
$exportFileName = 'arrived-parcel.xlsx';
|
$exportFileName = 'arrived-parcel.xlsx';
|
||||||
$filesystemDriver = Storage::getDefaultDriver();
|
$filesystemDriver = Storage::getDefaultDriver();
|
||||||
if($filesystemDriver === 's3'){
|
if ($filesystemDriver === 's3') {
|
||||||
return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsPendingArrangementDeliveryList) ]);
|
return response(['src' => AWSS3Helper::S3Exportable($exportFileName, $exportsPendingArrangementDeliveryList)]);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$response = $exportsPendingArrangementDeliveryList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
$response = $exportsPendingArrangementDeliveryList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function summary(Request $request) {
|
public function summary(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'startDate' => 'nullable|date_format:d-m-Y',
|
'startDate' => 'nullable|date_format:d-m-Y',
|
||||||
@@ -66,38 +66,37 @@ class ExportArrivedParcelController extends Controller
|
|||||||
$exportsParcelsSummary = new ExportsParcel($startDate, $endDate);
|
$exportsParcelsSummary = new ExportsParcel($startDate, $endDate);
|
||||||
$exportFileName = 'parcel-summary.xls';
|
$exportFileName = 'parcel-summary.xls';
|
||||||
$filesystemDriver = Storage::getDefaultDriver();
|
$filesystemDriver = Storage::getDefaultDriver();
|
||||||
if($filesystemDriver === 's3'){
|
if ($filesystemDriver === 's3') {
|
||||||
return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsParcelsSummary) ]);
|
return response(['src' => AWSS3Helper::S3Exportable($exportFileName, $exportsParcelsSummary)]);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$response = $exportsParcelsSummary->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
$response = $exportsParcelsSummary->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function guangZhou2ToJohor(Request $request) {
|
public function guangZhou2ToJohor(Request $request)
|
||||||
|
{
|
||||||
$exportsWarehousePackingList = new ExportsWarehousePackingList();
|
$exportsWarehousePackingList = new ExportsWarehousePackingList();
|
||||||
$exportFileName = 'guangzhou2-to-johor-summary.xls';
|
$exportFileName = 'guangzhou2-to-johor-summary.xls';
|
||||||
$filesystemDriver = Storage::getDefaultDriver();
|
$filesystemDriver = Storage::getDefaultDriver();
|
||||||
if($filesystemDriver === 's3'){
|
if ($filesystemDriver === 's3') {
|
||||||
return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsWarehousePackingList) ]);
|
return response(['src' => AWSS3Helper::S3Exportable($exportFileName, $exportsWarehousePackingList)]);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$response = $exportsWarehousePackingList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
$response = $exportsWarehousePackingList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function aging(Request $request) {
|
public function aging(Request $request)
|
||||||
|
{
|
||||||
$data = new ExportsAgingList();
|
$data = new ExportsAgingList();
|
||||||
$exportFileName = 'aging_report.xls';
|
$exportFileName = 'aging_report.xls';
|
||||||
$filesystemDriver = Storage::getDefaultDriver();
|
$filesystemDriver = Storage::getDefaultDriver();
|
||||||
if($filesystemDriver === 's3'){
|
if ($filesystemDriver === 's3') {
|
||||||
return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $data) ]);
|
return response(['src' => AWSS3Helper::S3Exportable($exportFileName, $data)]);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$response = $data->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
$response = $data->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $response;
|
return $response;
|
||||||
|
|||||||
@@ -15,35 +15,34 @@ class ExportPendingArrangementPackingListController extends Controller
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* ExportPendingArrangementPackingListController constructor.
|
* ExportPendingArrangementPackingListController constructor.
|
||||||
* @param Request $request
|
|
||||||
*/
|
*/
|
||||||
public function __construct(Request $request)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->middleware('auth.check');
|
$this->middleware('auth.check');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function export(Request $request) {
|
public function export(Request $request)
|
||||||
|
{
|
||||||
$exportsPendingArrangementDeliveryList = new ExportsPendingArrangementDeliveryList($request);
|
$exportsPendingArrangementDeliveryList = new ExportsPendingArrangementDeliveryList($request);
|
||||||
$exportFileName = 'packing-list-delivery.xls';
|
$exportFileName = 'packing-list-delivery.xls';
|
||||||
$filesystemDriver = Storage::getDefaultDriver();
|
$filesystemDriver = Storage::getDefaultDriver();
|
||||||
if($filesystemDriver === 's3'){
|
if ($filesystemDriver === 's3') {
|
||||||
return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsPendingArrangementDeliveryList) ]);
|
return response(['src' => AWSS3Helper::S3Exportable($exportFileName, $exportsPendingArrangementDeliveryList)]);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$response = $exportsPendingArrangementDeliveryList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
$response = $exportsPendingArrangementDeliveryList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onHold(Request $request) {
|
public function onHold(Request $request)
|
||||||
|
{
|
||||||
$exportsPendingArrangementDeliveryList = new ExportsOnHoldPackingList($request);
|
$exportsPendingArrangementDeliveryList = new ExportsOnHoldPackingList($request);
|
||||||
$exportFileName = 'packing-list-on-hold.xls';
|
$exportFileName = 'packing-list-on-hold.xls';
|
||||||
$filesystemDriver = Storage::getDefaultDriver();
|
$filesystemDriver = Storage::getDefaultDriver();
|
||||||
if($filesystemDriver === 's3'){
|
if ($filesystemDriver === 's3') {
|
||||||
return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $exportsPendingArrangementDeliveryList) ]);
|
return response(['src' => AWSS3Helper::S3Exportable($exportFileName, $exportsPendingArrangementDeliveryList)]);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$response = $exportsPendingArrangementDeliveryList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
$response = $exportsPendingArrangementDeliveryList->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $response;
|
return $response;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\PackingLists\Packages\items;
|
namespace App\Http\Controllers\PackingLists\Packages\Items;
|
||||||
|
|
||||||
use App\Classes\Modules\PackageItems\ControllersLogic\CreatePackageItemLogic;
|
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items\CreatePackageItemLogic;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -13,7 +13,8 @@ class CreatePackageItemController
|
|||||||
* @param CreatePackageItemLogic $logic
|
* @param CreatePackageItemLogic $logic
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function create(Request $request, CreatePackageItemLogic $logic): JsonResponse {
|
public function create(Request $request, CreatePackageItemLogic $logic): JsonResponse
|
||||||
|
{
|
||||||
return $logic->execute($request);
|
return $logic->execute($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\PackingLists\Packages\items;
|
namespace App\Http\Controllers\PackingLists\Packages\Items;
|
||||||
|
|
||||||
use App\Classes\Modules\PackageItems\ControllersLogic\DeletePackageItemLogic;
|
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items\DeletePackageItemLogic;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -13,7 +13,8 @@ class DeletePackageItemController
|
|||||||
* @param DeletePackageItemLogic $logic
|
* @param DeletePackageItemLogic $logic
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, DeletePackageItemLogic $logic): JsonResponse {
|
public function delete(Request $request, DeletePackageItemLogic $logic): JsonResponse
|
||||||
|
{
|
||||||
return $logic->execute($request);
|
return $logic->execute($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\PackingLists\Packages\items;
|
namespace App\Http\Controllers\PackingLists\Packages\Items;
|
||||||
|
|
||||||
use App\Classes\Modules\PackageItems\ControllersLogic\FetchPackageItemLogic;
|
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items\FetchPackageItemLogic;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -13,7 +13,8 @@ class FetchPackageItemController
|
|||||||
* @param FetchPackageItemLogic $logic
|
* @param FetchPackageItemLogic $logic
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function fetch(Request $request, FetchPackageItemLogic $logic): JsonResponse {
|
public function fetch(Request $request, FetchPackageItemLogic $logic): JsonResponse
|
||||||
|
{
|
||||||
return $logic->execute($request);
|
return $logic->execute($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\PackingLists\Packages\items;
|
namespace App\Http\Controllers\PackingLists\Packages\Items;
|
||||||
|
|
||||||
use App\Classes\Modules\PackageItems\ControllersLogic\ListPackageItemsLogic;
|
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items\ListPackageItemsLogic;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -10,10 +10,11 @@ class ListPackageItemsController
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param ListPackageItemLogic $logic
|
* @param ListPackageItemsLogic $logic
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function list(Request $request, ListPackageItemsLogic $logic): JsonResponse {
|
public function list(Request $request, ListPackageItemsLogic $logic): JsonResponse
|
||||||
|
{
|
||||||
return $logic->execute($request);
|
return $logic->execute($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\PackingLists\Packages\items;
|
namespace App\Http\Controllers\PackingLists\Packages\Items;
|
||||||
|
|
||||||
use App\Classes\Modules\PackageItems\ControllersLogic\UpdatePackageItemLogic;
|
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\Items\UpdatePackageItemLogic;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -13,7 +13,8 @@ class UpdatePackageItemController
|
|||||||
* @param UpdatePackageItemLogic $logic
|
* @param UpdatePackageItemLogic $logic
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, UpdatePackageItemLogic $logic): JsonResponse {
|
public function update(Request $request, UpdatePackageItemLogic $logic): JsonResponse
|
||||||
|
{
|
||||||
return $logic->execute($request);
|
return $logic->execute($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use Carbon\Carbon;
|
|||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class CreatePermitsReminderController
|
class CreatePermitsReminderController
|
||||||
{
|
{
|
||||||
@@ -19,7 +20,7 @@ class CreatePermitsReminderController
|
|||||||
{
|
{
|
||||||
// Define validation rules
|
// Define validation rules
|
||||||
$rules = [
|
$rules = [
|
||||||
'model' => 'required|unique:permits_reminders,model',
|
'model' => ['required', Rule::unique('permits_reminders', 'model')],
|
||||||
'expiry_date' => 'required|date|after_or_equal:today',
|
'expiry_date' => 'required|date|after_or_equal:today',
|
||||||
'reminder_date' => 'required|date|after_or_equal:today',
|
'reminder_date' => 'required|date|after_or_equal:today',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use Carbon\Carbon;
|
|||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class UpdatePermitsReminderController
|
class UpdatePermitsReminderController
|
||||||
{
|
{
|
||||||
@@ -17,7 +18,7 @@ class UpdatePermitsReminderController
|
|||||||
public function update(Request $request): JsonResponse
|
public function update(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
'model' => 'required|unique:permits_reminders,model,' . $request->route('id'),
|
'model' => ['required', Rule::unique('permits_reminders', 'model')->ignore($request->route('id'))],
|
||||||
'expiry_date' => 'required|date|after_or_equal:today',
|
'expiry_date' => 'required|date|after_or_equal:today',
|
||||||
'reminder_date' => 'required|date|after_or_equal:today',
|
'reminder_date' => 'required|date|after_or_equal:today',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http;
|
|
||||||
|
|
||||||
use App\Http\Middleware\ValidateToken;
|
|
||||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
|
||||||
|
|
||||||
class Kernel extends HttpKernel
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The application's global HTTP middleware stack.
|
|
||||||
*
|
|
||||||
* These middleware are run during every request to your application.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $middleware = [
|
|
||||||
// \App\Http\Middleware\TrustHosts::class,
|
|
||||||
\App\Http\Middleware\TrustProxies::class,
|
|
||||||
\Fruitcake\Cors\HandleCors::class,
|
|
||||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
|
||||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
|
||||||
\App\Http\Middleware\TrimStrings::class,
|
|
||||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The application's route middleware groups.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $middlewareGroups = [
|
|
||||||
'web' => [
|
|
||||||
\App\Http\Middleware\EncryptCookies::class,
|
|
||||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
|
||||||
\Illuminate\Session\Middleware\StartSession::class,
|
|
||||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
|
||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
|
||||||
],
|
|
||||||
|
|
||||||
'api' => [
|
|
||||||
'throttle:300,1',
|
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
|
||||||
],
|
|
||||||
|
|
||||||
'apipub' => [
|
|
||||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The application's route middleware.
|
|
||||||
*
|
|
||||||
* These middleware may be assigned to groups or used individually.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $routeMiddleware = [
|
|
||||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
|
||||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
|
||||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
|
||||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
|
||||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
|
||||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
|
||||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
|
||||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
|
||||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
|
||||||
'valid.token' => ValidateToken::class,
|
|
||||||
'token.check' => \App\Http\Middleware\TokenCheckerMiddleware::class,
|
|
||||||
'auth.check' => \App\Http\Middleware\CheckAuthorizationMiddleware::class,
|
|
||||||
'storage.invoice.check.byorder' => \App\Http\Middleware\CheckForStorageInvoiceByOrderId::class,
|
|
||||||
'storage.invoice.check.bytransaction' => \App\Http\Middleware\CheckForStorageInvoiceByTransactionId::class,
|
|
||||||
'storage.invoice.check.bytransactions' => \App\Http\Middleware\CheckForStorageInvoiceByTransactions::class,
|
|
||||||
'storage.invoice.check.bygroup' => \App\Http\Middleware\CheckForStorageInvoiceByGroup::class,
|
|
||||||
'storage.invoice.check.bypackinglists' => \App\Http\Middleware\CheckForStorageInvoiceByPackingLists::class,
|
|
||||||
'admin' => \App\Http\Middleware\EnsureUserIsAdmin::class, //cief maintenance
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Classes\General\LogHelper;
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class LogRequestPathMiddleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next)
|
||||||
|
{
|
||||||
|
if(env('APP_ENV') !== 'local'){
|
||||||
|
$method = $request->method();
|
||||||
|
$fullUrl = $request->fullUrl();
|
||||||
|
LogHelper::channel('request_path')->info('Request Method: ' . $method);
|
||||||
|
LogHelper::channel('request_path')->info('Request URL: ' . $fullUrl);
|
||||||
|
|
||||||
|
|
||||||
|
if ($request->isMethod('post')) {
|
||||||
|
$payload = $request->all();
|
||||||
|
LogHelper::channel('request_path')->info('Request Payload POST: ', $payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use App\Providers\RouteServiceProvider;
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
@@ -23,7 +22,7 @@ class RedirectIfAuthenticated
|
|||||||
|
|
||||||
foreach ($guards as $guard) {
|
foreach ($guards as $guard) {
|
||||||
if (Auth::guard($guard)->check()) {
|
if (Auth::guard($guard)->check()) {
|
||||||
return redirect(RouteServiceProvider::HOME);
|
return redirect('/dashboard');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class TrustProxies extends Middleware
|
class TrustProxies extends Middleware
|
||||||
|
|||||||
@@ -11,19 +11,6 @@ use Tymon\JWTAuth\JWT;
|
|||||||
|
|
||||||
class ValidateToken
|
class ValidateToken
|
||||||
{
|
{
|
||||||
/** @var JWT */
|
|
||||||
private $manager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ValidateToken constructor.
|
|
||||||
* @param JWT $manager
|
|
||||||
*/
|
|
||||||
public function __construct(JWT $manager)
|
|
||||||
{
|
|
||||||
$this->manager = $manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if jwt token is valid.
|
* Checks if jwt token is valid.
|
||||||
*
|
*
|
||||||
@@ -35,7 +22,9 @@ class ValidateToken
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(!$this->manager->check()){ throw new AccessUnauthorisedException(); }
|
if (!auth('api')->check()) {
|
||||||
|
throw new AccessUnauthorisedException();
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace App\Logging;
|
namespace App\Logging;
|
||||||
|
|
||||||
use Aws\CloudWatchLogs\CloudWatchLogsClient;
|
use Aws\CloudWatchLogs\CloudWatchLogsClient;
|
||||||
use Maxbanton\Cwh\Handler\CloudWatch;
|
use PhpNexus\Cwh\Handler\CloudWatch;
|
||||||
use Monolog\Formatter\JsonFormatter;
|
use Monolog\Formatter\JsonFormatter;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,21 @@ namespace App\Models;
|
|||||||
use App\Classes\General\Interfaces\Notifiable;
|
use App\Classes\General\Interfaces\Notifiable;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
use Spatie\Activitylog\LogOptions;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||||
|
|
||||||
class AbstractModel extends Model implements Notifiable
|
class AbstractModel extends Model implements Notifiable
|
||||||
{
|
{
|
||||||
use LogsActivity;
|
use LogsActivity;
|
||||||
protected static $logFillable = true;
|
|
||||||
|
/**
|
||||||
|
* Get the options for logging activity.
|
||||||
|
*/
|
||||||
|
public function getActivitylogOptions(): LogOptions
|
||||||
|
{
|
||||||
|
return LogOptions::defaults()
|
||||||
|
->logFillable();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return MorphTo
|
* @return MorphTo
|
||||||
|
|||||||
+18
-10
@@ -15,22 +15,30 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|||||||
* Class Address
|
* Class Address
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property int country_id
|
* @property int $country_id
|
||||||
* @property int company_id
|
* @property int $state_id
|
||||||
* @property int state_id
|
* @property int $district_id
|
||||||
* @property int district_id
|
* @property string $postcode
|
||||||
* @property string postcode
|
* @property string $street_one
|
||||||
* @property string street_one
|
* @property string $street_two
|
||||||
* @property string street_two
|
* @property int $billing_type
|
||||||
* @property integer billing_type
|
*
|
||||||
|
* @property \App\Models\Country $country
|
||||||
|
* @property \App\Models\State $state
|
||||||
|
* @property \App\Models\District $district
|
||||||
*/
|
*/
|
||||||
class Address extends AbstractModel implements Contactable, Remarkable
|
class Address extends AbstractModel implements Contactable, Remarkable
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'addresses';
|
protected $table = 'addresses';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
protected $fillable = ['default'];
|
protected $fillable = ['default'];
|
||||||
|
|
||||||
|
|||||||
+15
-10
@@ -16,13 +16,13 @@ use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
|||||||
* Class Company
|
* Class Company
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property \App\Models\Country country_id
|
* @property int $country_id
|
||||||
* @property \App\Models\State state_id
|
* @property int $state_id
|
||||||
* @property \App\Models\District district_id
|
* @property int $district_id
|
||||||
* @property string postcode
|
* @property string $postcode
|
||||||
* @property string street_one
|
* @property string $street_one
|
||||||
* @property string street_two
|
* @property string $street_two
|
||||||
* @property integer billing_type
|
* @property int $billing_type
|
||||||
*/
|
*/
|
||||||
class Company extends AbstractModel implements Documentable, Contactable
|
class Company extends AbstractModel implements Documentable, Contactable
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,12 @@ class Company extends AbstractModel implements Documentable, Contactable
|
|||||||
|
|
||||||
protected $table = 'companies';
|
protected $table = 'companies';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return MorphMany
|
* @return MorphMany
|
||||||
@@ -63,8 +68,8 @@ class Company extends AbstractModel implements Documentable, Contactable
|
|||||||
$orders = [];
|
$orders = [];
|
||||||
|
|
||||||
$this->CompanyModules->each(function ($companyModule) {
|
$this->CompanyModules->each(function ($companyModule) {
|
||||||
$orders[] = $companyModule->orders->sortByDesc('id');
|
$orders[] = $companyModule->orders->sortByDesc('id');
|
||||||
});
|
});
|
||||||
|
|
||||||
return collect($orders);
|
return collect($orders);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
use PhpParser\Node\Expr\AssignOp\Mod;
|
use PhpParser\Node\Expr\AssignOp\Mod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CompanyModule
|
* Class CompanyConnection
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property \App\Models\Company company_id
|
* @property int $inviter_id
|
||||||
* @property integer type
|
* @property int $invitee_id
|
||||||
* @property integer status
|
* @property string $inviter_reference
|
||||||
|
* @property string $invitee_reference
|
||||||
|
* @property int $status
|
||||||
|
* @property bool $is_credit_term
|
||||||
*/
|
*/
|
||||||
class CompanyConnection extends AbstractModel
|
class CompanyConnection extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -33,7 +36,12 @@ class CompanyConnection extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'company_connections';
|
protected $table = 'company_connections';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
|
|||||||
@@ -9,10 +9,13 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
|||||||
* Class CompanyEmployee
|
* Class CompanyEmployee
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property \App\Models\companyModule company_module_id
|
* @property int $company_module_id
|
||||||
* @property \App\Models\User user_id
|
* @property int $user_id
|
||||||
* @property integer role_id
|
* @property int $role_id
|
||||||
* @property integer status
|
* @property int $status
|
||||||
|
*
|
||||||
|
* @property \App\Models\CompanyModule $companyModule
|
||||||
|
* @property \App\Models\User $user
|
||||||
*/
|
*/
|
||||||
class CompanyEmployee extends AbstractModel
|
class CompanyEmployee extends AbstractModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,9 +29,11 @@ use App\Classes\General\Interfaces\Remarkable;
|
|||||||
* Class CompanyModule
|
* Class CompanyModule
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property \App\Models\Company company_id
|
* @property int $company_id
|
||||||
* @property integer type
|
* @property int $type
|
||||||
* @property integer status
|
* @property int $status
|
||||||
|
*
|
||||||
|
* @property \App\Models\Company $company
|
||||||
*/
|
*/
|
||||||
class CompanyModule extends AbstractModel implements Addressable, Documentable, Contactable, ContainerOwner, Packable, Remarkable
|
class CompanyModule extends AbstractModel implements Addressable, Documentable, Contactable, ContainerOwner, Packable, Remarkable
|
||||||
{
|
{
|
||||||
@@ -40,7 +42,12 @@ class CompanyModule extends AbstractModel implements Addressable, Documentable,
|
|||||||
|
|
||||||
protected $table = 'company_modules';
|
protected $table = 'company_modules';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
@@ -95,7 +102,7 @@ class CompanyModule extends AbstractModel implements Addressable, Documentable,
|
|||||||
*/
|
*/
|
||||||
public function invites(): belongsToMany
|
public function invites(): belongsToMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(CompanyModule::class, CompanyConnection::class,'inviter_id', 'invitee_id');
|
return $this->belongsToMany(CompanyModule::class, CompanyConnection::class, 'inviter_id', 'invitee_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,11 +110,12 @@ class CompanyModule extends AbstractModel implements Addressable, Documentable,
|
|||||||
*/
|
*/
|
||||||
public function inviters(): belongsToMany
|
public function inviters(): belongsToMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(CompanyModule::class, CompanyConnection::class,'invitee_id', 'inviter_id');
|
return $this->belongsToMany(CompanyModule::class, CompanyConnection::class, 'invitee_id', 'inviter_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function connections(): hasMany {
|
public function connections(): hasMany
|
||||||
|
{
|
||||||
return $this->hasMany(CompanyConnection::class, 'invitee_id');
|
return $this->hasMany(CompanyConnection::class, 'invitee_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,29 +133,29 @@ class CompanyModule extends AbstractModel implements Addressable, Documentable,
|
|||||||
return $this->HasMany(Order::class, 'company_module_id');
|
return $this->HasMany(Order::class, 'company_module_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return belongsToMany
|
* @return belongsToMany
|
||||||
*/
|
*/
|
||||||
public function segments(): belongsToMany
|
public function segments(): belongsToMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Segment::class, (new SegmentCompany())->getTable(), 'company_id', 'segment_id');
|
return $this->belongsToMany(Segment::class, (new SegmentCompany())->getTable(), 'company_id', 'segment_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return MorphMany
|
* @return MorphMany
|
||||||
*/
|
*/
|
||||||
public function documents(): morphMany
|
public function documents(): morphMany
|
||||||
{
|
{
|
||||||
return $this->morphMany(Document::class, 'owner');
|
return $this->morphMany(Document::class, 'owner');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany
|
* @return HasMany
|
||||||
*/
|
*/
|
||||||
public function banks(): HasMany
|
public function banks(): HasMany
|
||||||
{
|
{
|
||||||
return $this->HasMany(BankAccount::class, 'company_id');
|
return $this->HasMany(BankAccount::class, 'company_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return MorphMany
|
* @return MorphMany
|
||||||
@@ -197,7 +205,7 @@ class CompanyModule extends AbstractModel implements Addressable, Documentable,
|
|||||||
*/
|
*/
|
||||||
public function transactions(): hasManyDeep
|
public function transactions(): hasManyDeep
|
||||||
{
|
{
|
||||||
return $this->hasManyDeep(Transaction::class, [Order::class], ['company_module_id', 'owner_id'], ['id', 'id']);
|
return $this->hasManyDeep(Transaction::class, [Order::class], ['company_module_id', 'owner_id'], ['id', 'id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Segment
|
* Class ConnectionSegment
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property string name
|
* @property string $name
|
||||||
* @property string reference
|
* @property string $reference
|
||||||
*/
|
*/
|
||||||
class ConnectionSegment extends AbstractModel
|
class ConnectionSegment extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -18,7 +18,12 @@ class ConnectionSegment extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'connection_segments';
|
protected $table = 'connection_segments';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany
|
* @return HasMany
|
||||||
|
|||||||
+16
-8
@@ -9,13 +9,16 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|||||||
* Class Contact
|
* Class Contact
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property int owner_id
|
* @property int $id
|
||||||
* @property string owner_type
|
* @property int $owner_id
|
||||||
* @property string reference
|
* @property string $owner_type
|
||||||
* @property string phone
|
* @property string $reference
|
||||||
* @property string email
|
* @property string $phone
|
||||||
* @property string wechat_id
|
* @property string $email
|
||||||
* @property int default
|
* @property string $wechat_id
|
||||||
|
* @property int $default
|
||||||
|
*
|
||||||
|
* @property mixed $owner
|
||||||
*/
|
*/
|
||||||
class Contact extends AbstractModel
|
class Contact extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -23,7 +26,12 @@ class Contact extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'contacts';
|
protected $table = 'contacts';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||||
|
|||||||
@@ -21,7 +21,12 @@ class Container extends AbstractModel implements Transportable, Remarkable
|
|||||||
|
|
||||||
protected $fillable = ['status'];
|
protected $fillable = ['status'];
|
||||||
|
|
||||||
protected $dates = ['loading_date'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'loading_date' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function packingLists(): belongsToMany
|
public function packingLists(): belongsToMany
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* Class Country
|
* Class Country
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property string name
|
* @property string $name
|
||||||
* @property string short_code
|
* @property string $short_code
|
||||||
* @property string phone_code
|
* @property string $phone_code
|
||||||
*/
|
*/
|
||||||
class Country extends AbstractModel
|
class Country extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,12 @@ class Country extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'countries';
|
protected $table = 'countries';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
protected $fillable = ['name', 'short_code', 'phone_code'];
|
protected $fillable = ['name', 'short_code', 'phone_code'];
|
||||||
|
|
||||||
|
|||||||
+14
-5
@@ -12,10 +12,14 @@ use Illuminate\Database\Eloquent\Relations\hasMany;
|
|||||||
* Class Currency
|
* Class Currency
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property \App\Models\Country country_id
|
* @property int $id
|
||||||
* @property string name
|
* @property int $country_id
|
||||||
* @property string short_code
|
* @property string $name
|
||||||
* @property string symbol
|
* @property string $short_code
|
||||||
|
* @property string $symbol
|
||||||
|
*
|
||||||
|
* @property \App\Models\Country $country
|
||||||
|
* @property \Illuminate\Database\Eloquent\Collection|\App\Models\CurrencyRate[] $rates
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Currency extends AbstractModel
|
class Currency extends AbstractModel
|
||||||
@@ -24,7 +28,12 @@ class Currency extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'currencies';
|
protected $table = 'currencies';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
|
|||||||
@@ -12,5 +12,10 @@ class CurrencyRate extends AbstractModel
|
|||||||
|
|
||||||
protected $fillable = ['currency_id', 'selling', 'payment_method_type'];
|
protected $fillable = ['currency_id', 'selling', 'payment_method_type'];
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-5
@@ -10,10 +10,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* Class District
|
* Class District
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property \App\Models\Country country_id
|
* @property int $country_id
|
||||||
* @property \App\Models\State state_id
|
* @property int $state_id
|
||||||
* @property string name
|
* @property string $name
|
||||||
* @property string postcode
|
* @property string $postcode
|
||||||
|
*
|
||||||
|
* @property \App\Models\Country $country
|
||||||
|
* @property \App\Models\State $state
|
||||||
*/
|
*/
|
||||||
class District extends AbstractModel
|
class District extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -21,7 +24,12 @@ class District extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'districts';
|
protected $table = 'districts';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
|
|||||||
+16
-11
@@ -14,15 +14,15 @@ use Illuminate\Database\Eloquent\Relations\hasMany;
|
|||||||
* @package App\Models
|
* @package App\Models
|
||||||
* @version August 4, 2020, 4:36 am
|
* @version August 4, 2020, 4:36 am
|
||||||
*
|
*
|
||||||
* @property int owner_id
|
* @property int $owner_id
|
||||||
* @property int owner_type
|
* @property string $owner_type
|
||||||
* @property int document_type
|
* @property string $document_type
|
||||||
* @property string reference
|
* @property string $reference
|
||||||
* @property int status
|
* @property int $status
|
||||||
* @property \App\Models\User approver
|
* @property int $approver
|
||||||
* @property timestamp issued_date
|
* @property \Carbon\Carbon $issued_date
|
||||||
* @property timestamp expired_date
|
* @property \Carbon\Carbon $expired_date
|
||||||
* @property timestamp approved_date
|
* @property \Carbon\Carbon $approval_date
|
||||||
*/
|
*/
|
||||||
class Document extends AbstractModel
|
class Document extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -30,7 +30,12 @@ class Document extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'documents';
|
protected $table = 'documents';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||||
@@ -43,7 +48,7 @@ class Document extends AbstractModel
|
|||||||
/**
|
/**
|
||||||
* @return hasMany
|
* @return hasMany
|
||||||
*/
|
*/
|
||||||
public function files(): hasMany
|
public function files(): hasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(File::class, 'document_id');
|
return $this->hasMany(File::class, 'document_id');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,15 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CompanyEmployee
|
* Class Employee
|
||||||
* @package App\Models
|
* @package App\Models\Exchange
|
||||||
*
|
*
|
||||||
* @property \App\Models\Company company_id
|
* @property int $id
|
||||||
* @property \App\Models\User user_id
|
* @property int $company_id
|
||||||
|
* @property int $user_id
|
||||||
|
*
|
||||||
|
* @property \Illuminate\Database\Eloquent\Collection|\App\Models\Exchange\Company[] $company
|
||||||
|
* @property \App\Models\Exchange\User $user
|
||||||
*/
|
*/
|
||||||
class Employee extends AbstractModel
|
class Employee extends AbstractModel
|
||||||
{
|
{
|
||||||
|
|||||||
+9
-7
@@ -10,9 +10,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* @package App\Models
|
* @package App\Models
|
||||||
* @version August 4, 2020, 4:36 am
|
* @version August 4, 2020, 4:36 am
|
||||||
*
|
*
|
||||||
* @property \App\Models\Document document_id
|
* @property int $document_id
|
||||||
* @property text file
|
* @property array $file
|
||||||
* @property int file_type_id
|
* @property int $file_type_id
|
||||||
*/
|
*/
|
||||||
class File extends AbstractModel
|
class File extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -22,10 +22,12 @@ class File extends AbstractModel
|
|||||||
|
|
||||||
protected $fillable = ['file'];
|
protected $fillable = ['file'];
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
|
||||||
public function getFileAttribute($value)
|
|
||||||
{
|
{
|
||||||
return $value ? json_decode($value) : [];
|
return [
|
||||||
|
'file' => 'array',
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,12 @@ class KeyValuePair extends AbstractModel
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
protected $table = 'key_value_pairs';
|
protected $table = 'key_value_pairs';
|
||||||
|
|
||||||
|
|||||||
+30
-18
@@ -27,7 +27,12 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable,
|
|||||||
|
|
||||||
protected $table = 'orders';
|
protected $table = 'orders';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,26 +102,27 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable,
|
|||||||
|
|
||||||
protected static function booted()
|
protected static function booted()
|
||||||
{
|
{
|
||||||
// if (auth()->user()->type === RoleTypes::USER) {
|
// if (auth()->user()->type === RoleTypes::USER) {
|
||||||
// static::addGlobalScope(new CustomerOrdersScope);
|
// static::addGlobalScope(new CustomerOrdersScope);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addressesPendingVerification()
|
public function addressesPendingVerification()
|
||||||
{
|
{
|
||||||
return $this->addresses()->where('status','=',ApprovalStatus::PENDING_VERIFICATION);
|
return $this->addresses()->where('status', '=', ApprovalStatus::PENDING_VERIFICATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addressesApproved()
|
public function addressesApproved()
|
||||||
{
|
{
|
||||||
return $this->addresses()->where('status','=',ApprovalStatus::APPROVED);
|
return $this->addresses()->where('status', '=', ApprovalStatus::APPROVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function originWarehousePackages()
|
public function originWarehousePackages()
|
||||||
{
|
{
|
||||||
return $this->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST)
|
return $this->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST)
|
||||||
->whereDoesntHave('shippingSchedules',
|
->whereDoesntHave(
|
||||||
function($schedule) {
|
'shippingSchedules',
|
||||||
|
function ($schedule) {
|
||||||
return $schedule->dispatched()
|
return $schedule->dispatched()
|
||||||
->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||||
}
|
}
|
||||||
@@ -126,28 +132,33 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable,
|
|||||||
public function inTransitPackages()
|
public function inTransitPackages()
|
||||||
{
|
{
|
||||||
return $this->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST)->Shipping()
|
return $this->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST)->Shipping()
|
||||||
->whereHas('shippingSchedules',
|
->whereHas(
|
||||||
function($schedule) {
|
'shippingSchedules',
|
||||||
|
function ($schedule) {
|
||||||
return $schedule->dispatched()
|
return $schedule->dispatched()
|
||||||
->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->whereDoesntHave('containers', function($container) {
|
->whereDoesntHave(
|
||||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
'containers',
|
||||||
}
|
function ($container) {
|
||||||
)->whereHas('packages');
|
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||||
|
}
|
||||||
|
)->whereHas('packages');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destinationWarehousePackages()
|
public function destinationWarehousePackages()
|
||||||
{
|
{
|
||||||
return $this->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST)
|
return $this->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST)
|
||||||
->whereHas('containers',
|
->whereHas(
|
||||||
function($container) {
|
'containers',
|
||||||
|
function ($container) {
|
||||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->whereDoesntHave('deliverySchedules',
|
->whereDoesntHave(
|
||||||
function($schedule) {
|
'deliverySchedules',
|
||||||
|
function ($schedule) {
|
||||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||||
}
|
}
|
||||||
)->whereHas('packages');
|
)->whereHas('packages');
|
||||||
@@ -156,8 +167,9 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable,
|
|||||||
public function deliveredPackages()
|
public function deliveredPackages()
|
||||||
{
|
{
|
||||||
return $this->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST)
|
return $this->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST)
|
||||||
->whereHas('deliverySchedules',
|
->whereHas(
|
||||||
function($schedule) {
|
'deliverySchedules',
|
||||||
|
function ($schedule) {
|
||||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,7 +12,12 @@ class PermitsReminder extends Model
|
|||||||
|
|
||||||
protected $table = 'permits_reminders';
|
protected $table = 'permits_reminders';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
protected $fillable = ['model', 'expiry_date', 'reminder_date'];
|
protected $fillable = ['model', 'expiry_date', 'reminder_date'];
|
||||||
|
|
||||||
|
|||||||
+11
-3
@@ -14,7 +14,13 @@ class Schedule extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'schedules';
|
protected $table = 'schedules';
|
||||||
|
|
||||||
protected $dates = ['etd', 'eta'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'etd' => 'datetime',
|
||||||
|
'eta' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function owner(): morphTo
|
public function owner(): morphTo
|
||||||
{
|
{
|
||||||
@@ -30,7 +36,8 @@ class Schedule extends AbstractModel
|
|||||||
* @param $query
|
* @param $query
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function scopeDispatched($query){
|
public function scopeDispatched($query)
|
||||||
|
{
|
||||||
return $query->where('etd', '<', Carbon::now());
|
return $query->where('etd', '<', Carbon::now());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +45,8 @@ class Schedule extends AbstractModel
|
|||||||
* @param $query
|
* @param $query
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function scopeDropped($query){
|
public function scopeDropped($query)
|
||||||
|
{
|
||||||
return $query->where('eta', '<', Carbon::now());
|
return $query->where('eta', '<', Carbon::now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-11
@@ -9,8 +9,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* Class Segment
|
* Class Segment
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property string name
|
* @property string $name
|
||||||
* @property string reference
|
* @property string $reference
|
||||||
*/
|
*/
|
||||||
class Segment extends AbstractModel
|
class Segment extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -18,7 +18,12 @@ class Segment extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'segments';
|
protected $table = 'segments';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany
|
* @return HasMany
|
||||||
@@ -27,12 +32,12 @@ class Segment extends AbstractModel
|
|||||||
{
|
{
|
||||||
return $this->HasMany(SegmentConstant::class, 'segment_id', 'id');
|
return $this->HasMany(SegmentConstant::class, 'segment_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* @return belongsToMany
|
// * @return belongsToMany
|
||||||
*/
|
// */
|
||||||
public function companyConnections(): belongsToMany
|
// public function companyConnections(): belongsToMany
|
||||||
{
|
// {
|
||||||
return $this->belongsToMany(CompanyConnection::class, (new ConnectionSegment())->getTable(), 'segment_id', 'company_connection_id');
|
// return $this->belongsToMany(CompanyConnection::class, (new ConnectionSegment())->getTable(), 'segment_id', 'company_connection_id');
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,18 +10,25 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* Class SegmentConstant
|
* Class SegmentConstant
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property \App\Models\Segment segment_id
|
* @property int $id
|
||||||
* @property string detail
|
* @property int $segment_id
|
||||||
|
* @property string $reference
|
||||||
|
* @property array $detail
|
||||||
|
* @property array $value
|
||||||
*/
|
*/
|
||||||
class SegmentConstant extends AbstractModel
|
class SegmentConstant extends AbstractModel
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'segment_constants';
|
protected $table = 'segment_constants';
|
||||||
|
|
||||||
public function getDetailAttribute($value)
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
return $value ? json_decode($value) : [];
|
return [
|
||||||
|
'detail' => 'array',
|
||||||
|
'value' => 'array',
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,9 +39,4 @@ class SegmentConstant extends AbstractModel
|
|||||||
return $this->BelongsTo(Segment::class, 'segment_id', 'id');
|
return $this->BelongsTo(Segment::class, 'segment_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getValueAttribute($value)
|
|
||||||
{
|
|
||||||
$value = $value ? json_decode($value) : [];
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* @package App\Models
|
* @package App\Models
|
||||||
* @version February 16, 2021, 9:04 pm
|
* @version February 16, 2021, 9:04 pm
|
||||||
*
|
*
|
||||||
* @property string name
|
* @property string $name
|
||||||
*/
|
*/
|
||||||
class ServiceType extends AbstractModel
|
class ServiceType extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -25,10 +25,6 @@ class ServiceType extends AbstractModel
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public $fillable = [
|
public $fillable = [
|
||||||
'name'
|
'name'
|
||||||
];
|
];
|
||||||
@@ -38,9 +34,13 @@ class ServiceType extends AbstractModel
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected function casts(): array
|
||||||
'name' => 'string'
|
{
|
||||||
];
|
return [
|
||||||
|
'name' => 'string',
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation rules
|
* Validation rules
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* Class State
|
* Class State
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property \App\Models\Country country_id
|
* @property int $country_id
|
||||||
* @property string name
|
* @property string $name
|
||||||
*/
|
*/
|
||||||
class State extends AbstractModel
|
class State extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -18,7 +18,12 @@ class State extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'states';
|
protected $table = 'states';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
|
|||||||
+7
-2
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
class Step extends AbstractModel
|
class Step extends AbstractModel
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
@@ -14,7 +14,12 @@ class Step extends AbstractModel
|
|||||||
|
|
||||||
protected $fillable = ['status'];
|
protected $fillable = ['status'];
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function owner(): morphTo
|
public function owner(): morphTo
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,9 +23,12 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
|
|||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
use LogData;
|
use LogData;
|
||||||
|
|
||||||
protected $casts = [
|
protected function casts(): array
|
||||||
'type' => 'int'
|
{
|
||||||
];
|
return [
|
||||||
|
'type' => 'int',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
protected $table = 'transactions';
|
protected $table = 'transactions';
|
||||||
|
|
||||||
@@ -95,12 +98,12 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
|
|||||||
*/
|
*/
|
||||||
public function groupsWithTrashed(): BelongsToMany
|
public function groupsWithTrashed(): BelongsToMany
|
||||||
{
|
{
|
||||||
return $this->BelongsToMany(Group::class, GroupTransaction::class, 'transaction_id')->withTrashed();;
|
return $this->BelongsToMany(Group::class, GroupTransaction::class, 'transaction_id')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function convert_original_amount()
|
public function convert_original_amount()
|
||||||
{
|
{
|
||||||
if($this->booking()->first()->fix_currency_id !== 1) {
|
if ($this->booking()->first()->fix_currency_id !== 1) {
|
||||||
$currency_rate = $this->currency()->first()->rates()->where('payment_method_type', $this->payment_method)->first();
|
$currency_rate = $this->currency()->first()->rates()->where('payment_method_type', $this->payment_method)->first();
|
||||||
|
|
||||||
return number_format($this->original_amount / $currency_rate->selling, 2);
|
return number_format($this->original_amount / $currency_rate->selling, 2);
|
||||||
@@ -123,11 +126,11 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
|
|||||||
*/
|
*/
|
||||||
public function scopeInComplete(Builder $query)
|
public function scopeInComplete(Builder $query)
|
||||||
{
|
{
|
||||||
return $query->where(function(Builder $query){
|
return $query->where(function (Builder $query) {
|
||||||
$query->where(function(Builder $query){
|
$query->where(function (Builder $query) {
|
||||||
$query->where('status', ApprovalStatus::PENDING_SUBMISSION)
|
$query->where('status', ApprovalStatus::PENDING_SUBMISSION)
|
||||||
->whereDate('expires_on', '>=', Carbon::now());
|
->whereDate('expires_on', '>=', Carbon::now());
|
||||||
})->orWhere(function(Builder $query){
|
})->orWhere(function (Builder $query) {
|
||||||
$query->where('status', ApprovalStatus::PENDING_VERIFICATION);
|
$query->where('status', ApprovalStatus::PENDING_VERIFICATION);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,7 +16,13 @@ class Transport extends AbstractModel
|
|||||||
|
|
||||||
protected $fillable = ['status', 'drop_date'];
|
protected $fillable = ['status', 'drop_date'];
|
||||||
|
|
||||||
protected $dates = ['dispatch_date', 'drop_date'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'dispatch_date' => 'datetime',
|
||||||
|
'drop_date' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||||
@@ -38,7 +44,8 @@ class Transport extends AbstractModel
|
|||||||
* @param $query
|
* @param $query
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function scopeDispatched($query){
|
public function scopeDispatched($query)
|
||||||
|
{
|
||||||
return $query->where('dispatch_date', '<', Carbon::now())->whereIn('status', [ApprovalStatus::APPROVED]);
|
return $query->where('dispatch_date', '<', Carbon::now())->whereIn('status', [ApprovalStatus::APPROVED]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +53,8 @@ class Transport extends AbstractModel
|
|||||||
* @param $query
|
* @param $query
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function scopeDropped($query){
|
public function scopeDropped($query)
|
||||||
|
{
|
||||||
return $query->where('drop_date', '<', Carbon::now())->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
return $query->where('drop_date', '<', Carbon::now())->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-3
@@ -27,7 +27,12 @@ class User extends AbstractModel implements
|
|||||||
{
|
{
|
||||||
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail, SoftDeletes;
|
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail, SoftDeletes;
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the identifier that will be stored in the subject claim of the JWT.
|
* Get the identifier that will be stored in the subject claim of the JWT.
|
||||||
@@ -49,14 +54,16 @@ class User extends AbstractModel implements
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function emailVerification(): HasMany {
|
public function emailVerification(): HasMany
|
||||||
|
{
|
||||||
return $this->hasMany(UserEmailVerification::class, 'email', 'email');
|
return $this->hasMany(UserEmailVerification::class, 'email', 'email');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany
|
* @return HasMany
|
||||||
*/
|
*/
|
||||||
public function passwordReset(): HasMany {
|
public function passwordReset(): HasMany
|
||||||
|
{
|
||||||
return $this->hasMany(PasswordReset::class, 'user_id', 'id');
|
return $this->hasMany(PasswordReset::class, 'user_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class District
|
* Class UserSocialAccount
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*
|
*
|
||||||
* @property \App\Models\User user_id
|
* @property int $id
|
||||||
* @property string app_id
|
* @property int $user_id
|
||||||
* @property int platform
|
* @property string $app_id
|
||||||
|
* @property int $platform
|
||||||
|
*
|
||||||
|
* @property \App\Models\User $user
|
||||||
*/
|
*/
|
||||||
class UserSocialAccount extends AbstractModel
|
class UserSocialAccount extends AbstractModel
|
||||||
{
|
{
|
||||||
@@ -20,7 +23,12 @@ class UserSocialAccount extends AbstractModel
|
|||||||
|
|
||||||
protected $table = 'user_social_accounts';
|
protected $table = 'user_social_accounts';
|
||||||
|
|
||||||
protected $dates = ['deleted_at'];
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'deleted_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsTo
|
* @return BelongsTo
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ namespace App\Providers;
|
|||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@@ -25,5 +28,9 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
Schema::defaultStringLength(191);
|
Schema::defaultStringLength(191);
|
||||||
|
|
||||||
|
RateLimiter::for('api', function (Request $request) {
|
||||||
|
return Limit::perMinute(300)->by($request->user()?->id ?: $request->ip());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Cache\RateLimiting\Limit;
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\RateLimiter;
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The path to the "home" route for your application.
|
|
||||||
*
|
|
||||||
* This is used by Laravel authentication to redirect users after login.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public const HOME = '/home';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The controller namespace for the application.
|
|
||||||
*
|
|
||||||
* When present, controller route declarations will automatically be prefixed with this namespace.
|
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
|
||||||
protected $namespace = 'App\\Http\\Controllers';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define your route model bindings, pattern filters, etc.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
$this->configureRateLimiting();
|
|
||||||
|
|
||||||
$this->routes(function () {
|
|
||||||
Route::prefix('api')
|
|
||||||
->middleware('api')
|
|
||||||
->namespace($this->namespace)
|
|
||||||
->group(base_path('routes/api.php'));
|
|
||||||
|
|
||||||
Route::prefix('public/api')
|
|
||||||
->middleware('apipub')
|
|
||||||
->namespace($this->namespace)
|
|
||||||
->group(base_path('routes/apipub.php'));
|
|
||||||
|
|
||||||
Route::middleware('web')
|
|
||||||
->namespace($this->namespace)
|
|
||||||
->group(base_path('routes/web.php'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configure the rate limiters for the application.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function configureRateLimiting()
|
|
||||||
{
|
|
||||||
RateLimiter::for('api', function (Request $request) {
|
|
||||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+196
-36
@@ -11,45 +11,205 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$app = new Illuminate\Foundation\Application(
|
use Illuminate\Foundation\Application;
|
||||||
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
use Illuminate\Foundation\Configuration\Exceptions;
|
||||||
);
|
use Illuminate\Foundation\Configuration\Middleware;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use App\Classes\ValueObjects\Response\ApiResponseObject;
|
||||||
|
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||||
|
use Illuminate\Auth\AuthenticationException;
|
||||||
|
|
||||||
/*
|
return Application::configure(basePath: dirname(__DIR__))
|
||||||
|--------------------------------------------------------------------------
|
->withRouting(
|
||||||
| Bind Important Interfaces
|
web: __DIR__ . '/../routes/web.php',
|
||||||
|--------------------------------------------------------------------------
|
api: __DIR__ . '/../routes/api.php',
|
||||||
|
|
commands: __DIR__ . '/../routes/console.php',
|
||||||
| Next, we need to bind some important interfaces into the container so
|
health: '/up',
|
||||||
| we will be able to resolve them when needed. The kernels serve the
|
then: function () {
|
||||||
| incoming requests to this application from both the web and CLI.
|
Route::prefix('public/api')
|
||||||
|
|
->middleware('apipub')
|
||||||
*/
|
->group(base_path('routes/apipub.php'));
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
$app->singleton(
|
->withMiddleware(function (Middleware $middleware) {
|
||||||
Illuminate\Contracts\Http\Kernel::class,
|
// '*' trusts all proxies, required for correct IP/HTTPS detection behind AWS ALB/Vapor
|
||||||
App\Http\Kernel::class
|
$middleware->trustProxies(at: '*');
|
||||||
);
|
|
||||||
|
|
||||||
$app->singleton(
|
$middleware->web(append: [
|
||||||
Illuminate\Contracts\Console\Kernel::class,
|
\App\Http\Middleware\LogRequestPathMiddleware::class,
|
||||||
App\Console\Kernel::class
|
]);
|
||||||
);
|
|
||||||
|
|
||||||
$app->singleton(
|
$middleware->api(append: [
|
||||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
\App\Http\Middleware\LogRequestPathMiddleware::class,
|
||||||
App\Exceptions\Handler::class
|
]);
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
$middleware->api(prepend: [
|
||||||
|--------------------------------------------------------------------------
|
'throttle:300,1',
|
||||||
| Return The Application
|
]);
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This script returns the application instance. The instance is given to
|
|
||||||
| the calling script so we can separate the building of the instances
|
|
||||||
| from the actual running of the application and sending responses.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
return $app;
|
$middleware->validateCsrfTokens(except: [
|
||||||
|
'move-order/api/move',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$middleware->alias([
|
||||||
|
'valid.token' => \App\Http\Middleware\ValidateToken::class,
|
||||||
|
'token.check' => \App\Http\Middleware\TokenCheckerMiddleware::class,
|
||||||
|
'auth.check' => \App\Http\Middleware\CheckAuthorizationMiddleware::class,
|
||||||
|
'storage.invoice.check.byorder' => \App\Http\Middleware\CheckForStorageInvoiceByOrderId::class,
|
||||||
|
'storage.invoice.check.bytransaction' => \App\Http\Middleware\CheckForStorageInvoiceByTransactionId::class,
|
||||||
|
'storage.invoice.check.bytransactions' => \App\Http\Middleware\CheckForStorageInvoiceByTransactions::class,
|
||||||
|
'storage.invoice.check.bygroup' => \App\Http\Middleware\CheckForStorageInvoiceByGroup::class,
|
||||||
|
'storage.invoice.check.bypackinglists' => \App\Http\Middleware\CheckForStorageInvoiceByPackingLists::class,
|
||||||
|
'admin' => \App\Http\Middleware\EnsureUserIsAdmin::class,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$middleware->appendToGroup('apipub', [
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
\App\Http\Middleware\LogRequestPathMiddleware::class,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
->withExceptions(function (Exceptions $exceptions) {
|
||||||
|
$exceptions->render(function (AuthenticationException $e, $request) {
|
||||||
|
if ($request->expectsJson()) {
|
||||||
|
return (new ApiResponseObject('Authentication', 'To keep your account secure, we need to re-validate it.', HttpStatus::ACCESS_UNAUTHORISED))->handler();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Don't flash these inputs
|
||||||
|
$exceptions->dontFlash([
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// $exceptions->render(function (MaintenanceModeException $e, $request) {
|
||||||
|
// return response()->view('pages.errors.maintenance');
|
||||||
|
// });
|
||||||
|
})
|
||||||
|
->withCommands([
|
||||||
|
__DIR__ . '/../app/Console/Commands',
|
||||||
|
__DIR__ . '/../app/Console/Commands/V2',
|
||||||
|
])
|
||||||
|
->withSchedule(function (Schedule $schedule) {
|
||||||
|
//Commands Version 2: Laravel Vapor with AWS
|
||||||
|
$isEnabled = env('COMMANDS_V2_ENABLED', false);
|
||||||
|
if ($isEnabled) {
|
||||||
|
// $schedule->command('dummy-command')
|
||||||
|
// ->everyFiveMinutes()
|
||||||
|
// ->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('housekeeping-s3-files-command')
|
||||||
|
->dailyAt('01:00')
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('password-reset-token-expriration-check-command')
|
||||||
|
->everySixHours()
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('new-user-registration-expire-check-command')
|
||||||
|
->everySixHours()
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
if (env('APP_ENV') === 'production') {
|
||||||
|
$schedule->command('curl-vt-command')
|
||||||
|
->cron('0 8 * * *')
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
// $schedule->command('curl-yd-order-list-command')
|
||||||
|
// ->cron('0 9-18/3 * * *')
|
||||||
|
// ->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('process-yd-by-traking-no-data-command')
|
||||||
|
->cron('0 8,11,14,17 * * *')
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('process-yd-portal-data-command')
|
||||||
|
->cron('0 9,12,15,18 * * *') //->cron('0 9-18/3 * * *')
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('fix-packinglist-command')
|
||||||
|
->cron('30 9-18/3 * * *')
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('fix-duplicate-container-reference-command')
|
||||||
|
->cron('0 1 * * *')
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('invoice-generate-command')
|
||||||
|
// ->hourly()
|
||||||
|
->cron('0 0-8,10-11,13-14,16-17,19-23 * * *')
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('billplz-failed-callback-fix-command')
|
||||||
|
->hourly()
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('check-storage-invoices-group-transactions-command')
|
||||||
|
->dailyAt('0:01')
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('permits-reminder-send-command')
|
||||||
|
->dailyAt('09:30')
|
||||||
|
->withoutOverlapping();
|
||||||
|
|
||||||
|
$schedule->command('process-delayed-jobs-command')
|
||||||
|
->everyFiveMinutes()
|
||||||
|
->withoutOverlapping();
|
||||||
|
} elseif (env('APP_ENV') === 'development') {
|
||||||
|
$schedule->command('process-delayed-jobs-command')
|
||||||
|
->everyTwoHours()
|
||||||
|
->withoutOverlapping();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Commands Version 1: Before AWS
|
||||||
|
else {
|
||||||
|
$schedule->command('command:curlVTCommand')
|
||||||
|
->cron('0 8 * * *')
|
||||||
|
->withoutOverlapping()
|
||||||
|
->appendOutputTo(storage_path() . '/logs/curlvt.log');
|
||||||
|
|
||||||
|
$schedule->command('command:curlYdOrderListCommand')
|
||||||
|
->cron('0 9-18/3 * * *')
|
||||||
|
->withoutOverlapping()
|
||||||
|
->appendOutputTo(storage_path() . '/logs/curlyd.log');
|
||||||
|
|
||||||
|
$schedule->command('fix-packinglist')
|
||||||
|
->cron('30 9-18/3 * * *')
|
||||||
|
->withoutOverlapping()
|
||||||
|
->appendOutputTo(storage_path() . '/logs/fix_packinglist.log');
|
||||||
|
|
||||||
|
// $schedule->command('command:curlYdOrderListCommand')
|
||||||
|
// ->cron('0 9 * * *')
|
||||||
|
// ->withoutOverlapping()
|
||||||
|
// ->appendOutputTo(storage_path().'/logs/departure_email.log');
|
||||||
|
|
||||||
|
$schedule->command('fix-duplicate-container-reference')
|
||||||
|
->cron('0 1 * * *')
|
||||||
|
->withoutOverlapping()
|
||||||
|
->appendOutputTo(storage_path() . '/logs/fix_duplicate_container_reference.log');
|
||||||
|
|
||||||
|
$schedule->command('invoice:generate')
|
||||||
|
->hourly()
|
||||||
|
->withoutOverlapping()
|
||||||
|
->appendOutputTo(storage_path() . '/logs/auto_generate_invoice.log');
|
||||||
|
|
||||||
|
$schedule->command('billplz-failed-callback:fix')
|
||||||
|
->hourly()
|
||||||
|
->withoutOverlapping()
|
||||||
|
->appendOutputTo(storage_path() . '/logs/fix_failed_callback_from_billplz.log');
|
||||||
|
|
||||||
|
$schedule->command('check-storage-invoices-group-transactions')
|
||||||
|
->dailyAt('0:01')
|
||||||
|
->withoutOverlapping()
|
||||||
|
->appendOutputTo(storage_path() . '/logs/check_storage_invoices.log');
|
||||||
|
|
||||||
|
$schedule->command('permitsReminder:send')
|
||||||
|
->dailyAt('09:30')
|
||||||
|
->withoutOverlapping()
|
||||||
|
->appendOutputTo(storage_path() . '/logs/permits-reminder-send.log');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->create();
|
||||||
|
|||||||
+27
-26
@@ -2,38 +2,42 @@
|
|||||||
"name": "laravel/laravel",
|
"name": "laravel/laravel",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"description": "The Laravel Framework.",
|
"description": "The Laravel Framework.",
|
||||||
"keywords": ["framework", "laravel"],
|
"keywords": [
|
||||||
|
"framework",
|
||||||
|
"laravel"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.3",
|
"php": "^8.3",
|
||||||
"ext-fileinfo": "^7.3",
|
"ext-fileinfo": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"barryvdh/laravel-dompdf": "^0.9.0",
|
"barryvdh/laravel-dompdf": "^3.0",
|
||||||
"carlos-meneses/laravel-mpdf": "^2.1",
|
"carlos-meneses/laravel-mpdf": "^2.1",
|
||||||
"doctrine/dbal": "^3.1",
|
"doctrine/dbal": "^3.1",
|
||||||
"fideloper/proxy": "^4.4",
|
"guzzlehttp/guzzle": "^7.2",
|
||||||
"fruitcake/laravel-cors": "^2.0",
|
"intervention/image": "^3.0",
|
||||||
"guzzlehttp/guzzle": "^7.0.1",
|
"laravel/framework": "^12.0",
|
||||||
"intervention/image": "^2.5",
|
"laravel/tinker": "^2.9",
|
||||||
"laravel/framework": "^8.40",
|
|
||||||
"laravel/tinker": "^2.5",
|
|
||||||
"laravel/vapor-cli": "^1.60",
|
"laravel/vapor-cli": "^1.60",
|
||||||
"laravel/vapor-core": "^2.33",
|
"laravel/vapor-core": "^2.33",
|
||||||
|
"league/flysystem-aws-s3-v3": "^3.0",
|
||||||
"maatwebsite/excel": "^3.1",
|
"maatwebsite/excel": "^3.1",
|
||||||
"maxbanton/cwh": "^2.0",
|
"phpnexus/cwh": "^3.0",
|
||||||
"rinvex/countries": "^6.1",
|
"rinvex/countries": "^9.0",
|
||||||
"spatie/laravel-activitylog": "^3.14",
|
"spatie/laravel-activitylog": "^4.8",
|
||||||
"spatie/laravel-permission": "^4.2",
|
"spatie/laravel-permission": "^6.0",
|
||||||
"staudenmeir/eloquent-has-many-deep": "^1.7",
|
"staudenmeir/eloquent-has-many-deep": "^1.19",
|
||||||
"tymon/jwt-auth": "^1.0"
|
"symfony/http-client": "^7.4",
|
||||||
|
"symfony/mailgun-mailer": "^7.4",
|
||||||
|
"tymon/jwt-auth": "^2.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"facade/ignition": "^2.5",
|
"spatie/laravel-ignition": "^3.0",
|
||||||
"fakerphp/faker": "^1.9.1",
|
"fakerphp/faker": "^1.23",
|
||||||
"laravel/sail": "^1.0.1",
|
"laravel/sail": "^1.26",
|
||||||
"mockery/mockery": "^1.4.2",
|
"mockery/mockery": "^1.6",
|
||||||
"nunomaduro/collision": "^5.0",
|
"nunomaduro/collision": "^8.0",
|
||||||
"phpunit/phpunit": "^9.3.3"
|
"phpunit/phpunit": "^11.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@@ -67,10 +71,7 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
"preferred-install": "dist",
|
"preferred-install": "dist",
|
||||||
"sort-packages": true,
|
"sort-packages": true
|
||||||
"audit": {
|
|
||||||
"block-insecure": false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"prefer-stable": true
|
"prefer-stable": true
|
||||||
|
|||||||
+1
-2
@@ -173,7 +173,6 @@ return [
|
|||||||
App\Providers\AuthServiceProvider::class,
|
App\Providers\AuthServiceProvider::class,
|
||||||
// App\Providers\BroadcastServiceProvider::class,
|
// App\Providers\BroadcastServiceProvider::class,
|
||||||
App\Providers\EventServiceProvider::class,
|
App\Providers\EventServiceProvider::class,
|
||||||
App\Providers\RouteServiceProvider::class,
|
|
||||||
|
|
||||||
// Third Parties
|
// Third Parties
|
||||||
Spatie\Permission\PermissionServiceProvider::class,
|
Spatie\Permission\PermissionServiceProvider::class,
|
||||||
@@ -232,7 +231,7 @@ return [
|
|||||||
'URL' => Illuminate\Support\Facades\URL::class,
|
'URL' => Illuminate\Support\Facades\URL::class,
|
||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
'View' => Illuminate\Support\Facades\View::class,
|
||||||
'PDF' => Barryvdh\DomPDF\Facade::class,
|
'PDF' => Barryvdh\DomPDF\Facade\Pdf::class,
|
||||||
'MPDF' => Mccarlosen\LaravelMpdf\Facades\LaravelMpdf::class,
|
'MPDF' => Mccarlosen\LaravelMpdf\Facades\LaravelMpdf::class,
|
||||||
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
|
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
|
||||||
],
|
],
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
'paths' => ['api/*', 'public/api/*', 'sanctum/csrf-cookie'],
|
||||||
|
|
||||||
'allowed_methods' => ['*'],
|
'allowed_methods' => ['*'],
|
||||||
|
|
||||||
@@ -29,6 +29,6 @@ return [
|
|||||||
|
|
||||||
'max_age' => 0,
|
'max_age' => 0,
|
||||||
|
|
||||||
'supports_credentials' => false,
|
'supports_credentials' => false, //cief todo: 137
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('FILESYSTEM_DRIVER', 'local'),
|
'default' => env('FILESYSTEM_DISK', env('FILESYSTEM_DRIVER', 'local')),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -58,6 +58,7 @@ return [
|
|||||||
'url' => env('AWS_URL'),
|
'url' => env('AWS_URL'),
|
||||||
'endpoint' => env('AWS_ENDPOINT'),
|
'endpoint' => env('AWS_ENDPOINT'),
|
||||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||||
|
'throw' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -245,6 +245,30 @@ return [
|
|||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
'groupNamePrefix' => env('CLOUDWATCH_LOGGROUP_PREFIX'),
|
'groupNamePrefix' => env('CLOUDWATCH_LOGGROUP_PREFIX'),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'request_path' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/laravel_request_path.log'),
|
||||||
|
'level' => 'info',
|
||||||
|
],
|
||||||
|
|
||||||
|
'request_path_vapor' => [
|
||||||
|
'driver' => 'custom',
|
||||||
|
'via' => \App\Logging\CloudWatchLoggerFactory::class,
|
||||||
|
'formatter' => Monolog\Formatter\JsonFormatter::class,
|
||||||
|
'cloudwatch_stream_name' => 'request_path_vapor',
|
||||||
|
'sdk' => [
|
||||||
|
'region' => env('AWS_MY_REGION'),
|
||||||
|
'version' => 'latest',
|
||||||
|
'credentials' => [
|
||||||
|
'key' => env('AWS_CW_ACCESS'),
|
||||||
|
'secret' => env('AWS_CW_SECRET')
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'retention' => env('APP_ENV') === 'production' ? 90 : 14,
|
||||||
|
'level' => 'debug',
|
||||||
|
'groupNamePrefix' => env('CLOUDWATCH_LOGGROUP_PREFIX'),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
+42
-10
@@ -8,25 +8,57 @@ class AddIsWaivedToTransactionsLogsTable extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('transaction_logs', function (Blueprint $table) {
|
if (!Schema::hasTable('transaction_logs')) {
|
||||||
$table->boolean('is_waived')->nullable()->after('status')->default(false);
|
// Create the table from scratch
|
||||||
});
|
Schema::create('transaction_logs', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->bigInteger('transaction_id');
|
||||||
|
$table->string('owner_type', 250);
|
||||||
|
$table->unsignedBigInteger('owner_id');
|
||||||
|
$table->string('type')->default('1');
|
||||||
|
$table->unsignedBigInteger('issuer');
|
||||||
|
$table->unsignedBigInteger('receiver');
|
||||||
|
$table->unsignedBigInteger('recipient_bank_account_id');
|
||||||
|
$table->string('payment_method')->nullable();
|
||||||
|
$table->string('payment_reference')->nullable();
|
||||||
|
$table->string('bill_no');
|
||||||
|
$table->decimal('amount', 25, 5)->default(0);
|
||||||
|
$table->decimal('original_amount', 25, 5)->default(0);
|
||||||
|
$table->unsignedBigInteger('currency_id');
|
||||||
|
$table->unsignedBigInteger('original_currency_id');
|
||||||
|
$table->decimal('currency_rate', 14, 5)->default(0);
|
||||||
|
$table->decimal('tax', 14, 5)->default(0);
|
||||||
|
$table->decimal('service_charge', 14, 5)->default(0);
|
||||||
|
$table->timestamp('expires_on')->nullable();
|
||||||
|
$table->integer('status')->default(0);
|
||||||
|
$table->boolean('is_waived')->default(false);
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Add the column if the table exists
|
||||||
|
Schema::table('transaction_logs', function (Blueprint $table) {
|
||||||
|
if (!Schema::hasColumn('transaction_logs', 'is_waived')) {
|
||||||
|
$table->boolean('is_waived')->nullable()->after('status')->default(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('transaction_logs', function (Blueprint $table) {
|
if (Schema::hasTable('transaction_logs')) {
|
||||||
$table->dropColumn('is_waived');
|
Schema::table('transaction_logs', function (Blueprint $table) {
|
||||||
});
|
if (Schema::hasColumn('transaction_logs', 'is_waived')) {
|
||||||
|
$table->dropColumn('is_waived');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddEventColumnToActivityLogTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||||
|
$table->string('event')->nullable()->after('subject_type');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||||
|
$table->dropColumn('event');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddBatchUuidColumnToActivityLogTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||||
|
$table->uuid('batch_uuid')->nullable()->after('properties');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||||
|
$table->dropColumn('batch_uuid');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
FROM laravelphp/vapor:php74
|
FROM laravelphp/vapor:php83
|
||||||
|
|
||||||
COPY . /var/task
|
COPY . /var/task
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM php:7.4-fpm
|
FROM php:8.3-fpm
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
@@ -18,10 +18,10 @@ RUN apt-get update && apt-get install -y \
|
|||||||
&& docker-php-ext-install zip \
|
&& docker-php-ext-install zip \
|
||||||
&& docker-php-ext-install bcmath
|
&& docker-php-ext-install bcmath
|
||||||
|
|
||||||
COPY --from=composer:1.9.3 /usr/bin/composer /usr/bin/composer
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
#NODEJS & NPM
|
#NODEJS & NPM
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
|
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
|
||||||
RUN apt-get -y install nodejs
|
RUN apt-get -y install nodejs
|
||||||
|
|
||||||
RUN chown -R www-data:www-data /var/www
|
RUN chown -R www-data:www-data /var/www
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
shipping-portal-staging:
|
shipping-portal-development:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
#################################################################
|
#################################################################
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:stable-alpine
|
image: nginx:stable-alpine
|
||||||
container_name: shipping-portal-ngnix
|
container_name: shipping-portal-2-ngnix
|
||||||
ports:
|
ports:
|
||||||
- "8081:80"
|
- "8081:80"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -17,11 +17,11 @@ services:
|
|||||||
- php
|
- php
|
||||||
- mysql
|
- mysql
|
||||||
networks:
|
networks:
|
||||||
- shipping-portal-staging
|
- shipping-portal-development
|
||||||
#################################################################
|
#################################################################
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:5.7.29
|
image: mysql:5.7.29
|
||||||
container_name: shipping-portal-mysql
|
container_name: shipping-portal-2-mysql
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
tty: true
|
tty: true
|
||||||
ports:
|
ports:
|
||||||
@@ -36,19 +36,19 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- mysql-data:/var/lib/mysql
|
- mysql-data:/var/lib/mysql
|
||||||
networks:
|
networks:
|
||||||
- shipping-portal-staging
|
- shipping-portal-development
|
||||||
#################################################################
|
#################################################################
|
||||||
php:
|
php:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: shipping-portal-php
|
container_name: shipping-portal-2-php
|
||||||
volumes:
|
volumes:
|
||||||
- ../:/var/www/html
|
- ../:/var/www/html
|
||||||
ports:
|
ports:
|
||||||
- "9001:9000"
|
- "9001:9000"
|
||||||
networks:
|
networks:
|
||||||
- shipping-portal-staging
|
- shipping-portal-development
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user