Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
marco76tv committed Apr 12, 2024
1 parent 76c7a0b commit e2b1588
Show file tree
Hide file tree
Showing 12 changed files with 228 additions and 189 deletions.
17 changes: 10 additions & 7 deletions Models/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ abstract class BaseModel extends Model
/** @var array<int, string> */
protected $fillable = ['id'];

/** @var array<string, string> */
protected $casts = [
'published_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
/** @return array<string, string> */
protected function casts(): array
{
return [
'published_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
}

/** @var string */
protected $primaryKey = 'id';
Expand Down
15 changes: 9 additions & 6 deletions Models/BaseMorphPivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ abstract class BaseMorphPivot extends MorphPivot
'note',
];

protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
}
protected function casts(): array
{
return [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
}
}
48 changes: 22 additions & 26 deletions Models/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@
namespace Modules\Job\Models;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Carbon;

use function Safe\json_decode;

use Webmozart\Assert\Assert;

/**
*
*
* @method static \Modules\Job\Database\Factories\ExportFactory factory($count = null, $state = [])
* @method static Builder|Export newModelQuery()
* @method static Builder|Export newQuery()
* @method static Builder|Export query()
* @method static Builder|Export newModelQuery()
* @method static Builder|Export newQuery()
* @method static Builder|Export query()
*
* @mixin \Eloquent
*/
class Export extends BaseModel
Expand All @@ -39,18 +32,21 @@ class Export extends BaseModel
'user_id',
];

protected $casts = [
'data' => 'json',
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'payload' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'completed_at' => 'datetime',
// 'updated_at' => 'datetime:Y-m-d H:00',
// 'created_at' => 'datetime:Y-m-d',
// 'created_at' => 'datetime:d/m/Y H:i'
];
}
protected function casts(): array
{
return [
'data' => 'json',
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'payload' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'completed_at' => 'datetime',
// 'updated_at' => 'datetime:Y-m-d H:00',
// 'created_at' => 'datetime:Y-m-d',
// 'created_at' => 'datetime:d/m/Y H:i'
];
}
}
48 changes: 22 additions & 26 deletions Models/FailedImportRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@
namespace Modules\Job\Models;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Carbon;

use function Safe\json_decode;

use Webmozart\Assert\Assert;

/**
*
*
* @method static \Modules\Job\Database\Factories\FailedImportRowFactory factory($count = null, $state = [])
* @method static Builder|FailedImportRow newModelQuery()
* @method static Builder|FailedImportRow newQuery()
* @method static Builder|FailedImportRow query()
* @method static Builder|FailedImportRow newModelQuery()
* @method static Builder|FailedImportRow newQuery()
* @method static Builder|FailedImportRow query()
*
* @mixin \Eloquent
*/
class FailedImportRow extends BaseModel
Expand All @@ -34,18 +27,21 @@ class FailedImportRow extends BaseModel
'validation_error',
];

protected $casts = [
'data' => 'json',
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'payload' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'completed_at' => 'datetime',
// 'updated_at' => 'datetime:Y-m-d H:00',
// 'created_at' => 'datetime:Y-m-d',
// 'created_at' => 'datetime:d/m/Y H:i'
];
}
protected function casts(): array
{
return [
'data' => 'json',
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'payload' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'completed_at' => 'datetime',
// 'updated_at' => 'datetime:Y-m-d H:00',
// 'created_at' => 'datetime:Y-m-d',
// 'created_at' => 'datetime:d/m/Y H:i'
];
}
}
18 changes: 12 additions & 6 deletions Models/FailedJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@
* @method static Builder|FailedJob newModelQuery()
* @method static Builder|FailedJob newQuery()
* @method static Builder|FailedJob query()
*
* @property int $id
* @property string $uuid
* @property string $connection
* @property string $queue
* @property array $payload
* @property string $exception
* @property string $failed_at
*
* @method static Builder|FailedJob whereConnection($value)
* @method static Builder|FailedJob whereException($value)
* @method static Builder|FailedJob whereFailedAt($value)
* @method static Builder|FailedJob whereId($value)
* @method static Builder|FailedJob wherePayload($value)
* @method static Builder|FailedJob whereQueue($value)
* @method static Builder|FailedJob whereUuid($value)
*
* @mixin \Eloquent
*/
class FailedJob extends BaseModel
Expand All @@ -45,11 +48,14 @@ class FailedJob extends BaseModel
'failed_at',
];

protected $casts = [
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',
protected function casts(): array
{
return [
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'payload' => 'array',
];
'payload' => 'array',
];
}
}
48 changes: 22 additions & 26 deletions Models/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@
namespace Modules\Job\Models;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Carbon;

use function Safe\json_decode;

use Webmozart\Assert\Assert;

/**
*
*
* @method static \Modules\Job\Database\Factories\ImportFactory factory($count = null, $state = [])
* @method static Builder|Import newModelQuery()
* @method static Builder|Import newQuery()
* @method static Builder|Import query()
* @method static Builder|Import newModelQuery()
* @method static Builder|Import newQuery()
* @method static Builder|Import query()
*
* @mixin \Eloquent
*/
class Import extends BaseModel
Expand All @@ -39,18 +32,21 @@ class Import extends BaseModel
'user_id',
];

protected $casts = [
'data' => 'json',
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'payload' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'completed_at' => 'datetime',
// 'updated_at' => 'datetime:Y-m-d H:00',
// 'created_at' => 'datetime:Y-m-d',
// 'created_at' => 'datetime:d/m/Y H:i'
];
}
protected function casts(): array
{
return [
'data' => 'json',
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'payload' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'completed_at' => 'datetime',
// 'updated_at' => 'datetime:Y-m-d H:00',
// 'created_at' => 'datetime:Y-m-d',
// 'created_at' => 'datetime:d/m/Y H:i'
];
}
}
28 changes: 17 additions & 11 deletions Models/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @property string|null $created_by
* @property string|null $updated_by
* @property Carbon|null $updated_at
*
* @method static \Modules\Job\Database\Factories\JobFactory factory($count = null, $state = [])
* @method static Builder|Job newModelQuery()
* @method static Builder|Job newQuery()
Expand All @@ -43,8 +44,10 @@
* @method static Builder|Job whereReservedAt($value)
* @method static Builder|Job whereUpdatedAt($value)
* @method static Builder|Job whereUpdatedBy($value)
*
* @property mixed $display_name
* @property mixed $status
*
* @mixin \Eloquent
*/
class Job extends BaseModel
Expand All @@ -59,18 +62,21 @@ class Job extends BaseModel
'created_at',
];

protected $casts = [
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',
protected function casts(): array
{
return [
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'payload' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
// 'updated_at' => 'datetime:Y-m-d H:00',
// 'created_at' => 'datetime:Y-m-d',
// 'created_at' => 'datetime:d/m/Y H:i'
];
'payload' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
// 'updated_at' => 'datetime:Y-m-d H:00',
// 'created_at' => 'datetime:Y-m-d',
// 'created_at' => 'datetime:d/m/Y H:i'
];
}

public function getTable(): string
{
Expand Down
27 changes: 16 additions & 11 deletions Models/JobBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* @property Carbon|null $cancelled_at
* @property Carbon $created_at
* @property Carbon|null $finished_at
*
* @method static \Modules\Job\Database\Factories\JobBatchFactory factory($count = null, $state = [])
* @method static Builder|JobBatch newModelQuery()
* @method static Builder|JobBatch newQuery()
Expand All @@ -41,6 +42,7 @@
* @method static Builder|JobBatch whereOptions($value)
* @method static Builder|JobBatch wherePendingJobs($value)
* @method static Builder|JobBatch whereTotalJobs($value)
*
* @mixin \Eloquent
*/
class JobBatch extends BaseModel
Expand Down Expand Up @@ -81,17 +83,20 @@ class JobBatch extends BaseModel
*
* @var array<string, string>
*/
protected $casts = [
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'options' => 'collection',
'failed_jobs' => 'integer',
'created_at' => 'datetime',
'cancelled_at' => 'datetime',
'finished_at' => 'datetime',
];
protected function casts(): array
{
return [
'updated_by' => 'string',
'created_by' => 'string',
'deleted_by' => 'string',

'options' => 'collection',
'failed_jobs' => 'integer',
'created_at' => 'datetime',
'cancelled_at' => 'datetime',
'finished_at' => 'datetime',
];
}

/**
* Get the total number of jobs that have been processed by the batch thus far.
Expand Down
Loading

0 comments on commit e2b1588

Please sign in to comment.