Merge pull request #17044 from MadBox-99/patch-2

Update casts syntax in docs
This commit is contained in:
Dan Harrin
2025-07-22 09:58:25 +01:00
committed by GitHub
19 changed files with 197 additions and 89 deletions
+9 -3
View File
@@ -10,9 +10,15 @@ class Post extends Model
{
use HasFactory;
protected $casts = [
'is_featured' => 'boolean',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_featured' => 'boolean',
];
}
public function author(): BelongsTo
{
+8 -7
View File
@@ -37,14 +37,15 @@ class User extends Authenticatable implements FilamentUser
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
* @return array<string, string>
*/
protected $casts = [
'colleagues' => 'array',
'email_verified_at' => 'datetime',
];
protected function casts(): array
{
return [
'colleagues' => 'array',
'email_verified_at' => 'datetime',
];
}
public function canAccessPanel(Panel $panel): bool
{
+24 -16
View File
@@ -60,12 +60,15 @@ class User extends Authenticatable implements FilamentUser, MustVerifyEmail
];
/**
* @var array<string, string>
* @return array<string, string>
*/
protected $casts = [
// ...
'app_authentication_secret' => 'encrypted',
];
protected function casts(): array
{
return [
// ...
'app_authentication_secret' => 'encrypted',
];
}
// ...
}
@@ -165,12 +168,15 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
];
/**
* @var array<string, string>
* @return array<string, string>
*/
protected $casts = [
// ...
'app_authentication_recovery_codes' => 'encrypted:array',
];
protected function casts(): array
{
return [
// ...
'app_authentication_recovery_codes' => 'encrypted:array',
];
}
// ...
}
@@ -337,14 +343,16 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements FilamentUser, MustVerifyEmail
{
// ...
/**
* @var array<string, string>
* @return array<string, string>
*/
protected $casts = [
// ...
'has_email_authentication' => 'boolean',
];
protected function casts(): array
{
return [
// ...
'has_email_authentication' => 'boolean',
];
}
// ...
}
+12 -6
View File
@@ -27,12 +27,18 @@ class Export extends Model
{
use Prunable;
protected $casts = [
'completed_at' => 'timestamp',
'processed_rows' => 'integer',
'total_rows' => 'integer',
'successful_rows' => 'integer',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'completed_at' => 'timestamp',
'processed_rows' => 'integer',
'total_rows' => 'integer',
'successful_rows' => 'integer',
];
}
protected $guarded = [];
@@ -16,9 +16,15 @@ class FailedImportRow extends Model
{
use Prunable;
protected $casts = [
'data' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'data' => 'array',
];
}
protected $guarded = [];
+12 -6
View File
@@ -28,12 +28,18 @@ class Import extends Model
{
use Prunable;
protected $casts = [
'completed_at' => 'timestamp',
'processed_rows' => 'integer',
'total_rows' => 'integer',
'successful_rows' => 'integer',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'completed_at' => 'timestamp',
'processed_rows' => 'integer',
'total_rows' => 'integer',
'successful_rows' => 'integer',
];
}
protected $guarded = [];
+9 -3
View File
@@ -219,9 +219,15 @@ use Illuminate\Database\Eloquent\Model;
class App extends Model
{
protected $casts = [
'technologies' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'technologies' => 'array',
];
}
// ...
}
+9 -3
View File
@@ -23,9 +23,15 @@ use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $casts = [
'is_admin' => 'boolean',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_admin' => 'boolean',
];
}
// ...
}
+9 -3
View File
@@ -23,9 +23,15 @@ use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $casts = [
'is_admin' => 'boolean',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_admin' => 'boolean',
];
}
// ...
}
+9 -3
View File
@@ -32,9 +32,15 @@ use Illuminate\Database\Eloquent\Model;
class App extends Model
{
protected $casts = [
'technologies' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'technologies' => 'array',
];
}
// ...
}
+9 -3
View File
@@ -75,9 +75,15 @@ use Illuminate\Database\Eloquent\Model;
class Message extends Model
{
protected $casts = [
'attachments' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'attachments' => 'array',
];
}
// ...
}
+9 -3
View File
@@ -37,9 +37,15 @@ use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $casts = [
'content' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'content' => 'array',
];
}
// ...
}
+9 -3
View File
@@ -26,9 +26,15 @@ use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $casts = [
'tags' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'tags' => 'array',
];
}
// ...
}
+9 -3
View File
@@ -23,9 +23,15 @@ use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $casts = [
'meta' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'meta' => 'array',
];
}
// ...
}
+9 -3
View File
@@ -196,9 +196,15 @@ use Illuminate\Database\Eloquent\Model;
class App extends Model
{
protected $casts = [
'technologies' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'technologies' => 'array',
];
}
// ...
}
+9 -3
View File
@@ -139,9 +139,15 @@ use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $casts = [
'slider' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'slider' => 'array',
];
}
// ...
}
@@ -33,9 +33,15 @@ use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected $casts = [
'meta' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'meta' => 'array',
];
}
// ...
}
+13 -7
View File
@@ -14,13 +14,19 @@ class Post extends Model
use HasFactory;
use SoftDeletes;
protected $casts = [
'string_backed_enum' => StringBackedEnum::class,
'is_published' => 'boolean',
'tags' => 'array',
'json' => 'array',
'json_array_of_objects' => 'array',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'string_backed_enum' => StringBackedEnum::class,
'is_published' => 'boolean',
'tags' => 'array',
'json' => 'array',
'json_array_of_objects' => 'array',
];
}
protected $guarded = [];
+11 -8
View File
@@ -33,15 +33,18 @@ class User extends Authenticatable implements FilamentUser, HasAppAuthentication
];
/**
* @var array<string, string>
* @return array<string, string>
*/
protected $casts = [
'json' => 'array',
'email_verified_at' => 'datetime',
'app_authentication_secret' => 'encrypted',
'app_authentication_recovery_codes' => 'encrypted:array',
'has_email_authentication' => 'boolean',
];
protected function casts(): array
{
return [
'json' => 'array',
'email_verified_at' => 'datetime',
'app_authentication_secret' => 'encrypted',
'app_authentication_recovery_codes' => 'encrypted:array',
'has_email_authentication' => 'boolean',
];
}
public function canAccessPanel(Panel $panel): bool
{