mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Add support for Carbon serialization options (#1324)
* Add Carbon serialization option handling * Tests Added * Add changelog * Spellcheck
This commit is contained in:
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
|
|||||||
[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.12.2...master)
|
[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.12.2...master)
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fix date and datetime handling for attributes that set a serialization format option for the Carbon instance [#1324 / FLeudts](https://github.com/barryvdh/laravel-ide-helper/pull/1324)
|
||||||
|
|
||||||
2022-02-08, 2.12.2
|
2022-02-08, 2.12.2
|
||||||
------------------
|
------------------
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -362,6 +362,10 @@ class ModelsCommand extends Command
|
|||||||
$type = 'decimal';
|
$type = 'decimal';
|
||||||
} elseif (Str::startsWith($type, 'custom_datetime:')) {
|
} elseif (Str::startsWith($type, 'custom_datetime:')) {
|
||||||
$type = 'date';
|
$type = 'date';
|
||||||
|
} elseif (Str::startsWith($type, 'date:')) {
|
||||||
|
$type = 'date';
|
||||||
|
} elseif (Str::startsWith($type, 'datetime:')) {
|
||||||
|
$type = 'date';
|
||||||
} elseif (Str::startsWith($type, 'immutable_custom_datetime:')) {
|
} elseif (Str::startsWith($type, 'immutable_custom_datetime:')) {
|
||||||
$type = 'immutable_date';
|
$type = 'immutable_date';
|
||||||
} elseif (Str::startsWith($type, 'encrypted:')) {
|
} elseif (Str::startsWith($type, 'encrypted:')) {
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ class SimpleCast extends Model
|
|||||||
'cast_to_collection' => 'collection',
|
'cast_to_collection' => 'collection',
|
||||||
'cast_to_date' => 'date',
|
'cast_to_date' => 'date',
|
||||||
'cast_to_datetime' => 'datetime',
|
'cast_to_datetime' => 'datetime',
|
||||||
|
'cast_to_date_serialization' => 'date:Y-m-d',
|
||||||
|
'cast_to_datetime_serialization' => 'datetime:Y-m-d H:i:s',
|
||||||
'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s',
|
'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s',
|
||||||
'cast_to_immutable_date' => 'immutable_date',
|
'cast_to_immutable_date' => 'immutable_date',
|
||||||
'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s',
|
'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s',
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property \Illuminate\Support\Collection $cast_to_collection
|
* @property \Illuminate\Support\Collection $cast_to_collection
|
||||||
* @property \Illuminate\Support\Carbon $cast_to_date
|
* @property \Illuminate\Support\Carbon $cast_to_date
|
||||||
* @property \Illuminate\Support\Carbon $cast_to_datetime
|
* @property \Illuminate\Support\Carbon $cast_to_datetime
|
||||||
|
* @property \Illuminate\Support\Carbon $cast_to_date_serialization
|
||||||
|
* @property \Illuminate\Support\Carbon $cast_to_datetime_serialization
|
||||||
* @property \Illuminate\Support\Carbon $cast_to_custom_datetime
|
* @property \Illuminate\Support\Carbon $cast_to_custom_datetime
|
||||||
* @property \Carbon\CarbonImmutable $cast_to_immutable_date
|
* @property \Carbon\CarbonImmutable $cast_to_immutable_date
|
||||||
* @property \Carbon\CarbonImmutable $cast_to_immutable_custom_datetime
|
* @property \Carbon\CarbonImmutable $cast_to_immutable_custom_datetime
|
||||||
@@ -43,7 +45,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToCollection($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToCollection($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToCustomDatetime($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToCustomDatetime($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDate($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDate($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDateSerialization($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDatetime($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDatetime($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDatetimeSerialization($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDecimal($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDecimal($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDouble($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToDouble($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToEncrypted($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|SimpleCast whereCastToEncrypted($value)
|
||||||
@@ -82,6 +86,8 @@ class SimpleCast extends Model
|
|||||||
'cast_to_collection' => 'collection',
|
'cast_to_collection' => 'collection',
|
||||||
'cast_to_date' => 'date',
|
'cast_to_date' => 'date',
|
||||||
'cast_to_datetime' => 'datetime',
|
'cast_to_datetime' => 'datetime',
|
||||||
|
'cast_to_date_serialization' => 'date:Y-m-d',
|
||||||
|
'cast_to_datetime_serialization' => 'datetime:Y-m-d H:i:s',
|
||||||
'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s',
|
'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s',
|
||||||
'cast_to_immutable_date' => 'immutable_date',
|
'cast_to_immutable_date' => 'immutable_date',
|
||||||
'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s',
|
'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s',
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ class SimpleCastsTable extends Migration
|
|||||||
$table->string('cast_to_collection');
|
$table->string('cast_to_collection');
|
||||||
$table->string('cast_to_date');
|
$table->string('cast_to_date');
|
||||||
$table->string('cast_to_datetime');
|
$table->string('cast_to_datetime');
|
||||||
|
$table->string('cast_to_date_serialization');
|
||||||
|
$table->string('cast_to_datetime_serialization');
|
||||||
$table->string('cast_to_custom_datetime');
|
$table->string('cast_to_custom_datetime');
|
||||||
$table->string('cast_to_immutable_date');
|
$table->string('cast_to_immutable_date');
|
||||||
$table->string('cast_to_immutable_custom_datetime');
|
$table->string('cast_to_immutable_custom_datetime');
|
||||||
|
|||||||
Reference in New Issue
Block a user