Skip to content

Commit deb2ed2

Browse files
authoredJan 9, 2025··
fix(laravel): fix use laravel fillable for writable props (#6898)
Closes: #6875
1 parent a846079 commit deb2ed2

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed
 

‎src/Laravel/Eloquent/Metadata/Factory/Property/EloquentPropertyMetadataFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function create(string $resourceClass, string $property, array $options =
8888

8989
return $propertyMetadata
9090
->withBuiltinTypes([$type])
91-
->withWritable($propertyMetadata->isWritable() ?? true)
91+
->withWritable($propertyMetadata->isWritable() ?? true === $p['fillable'])
9292
->withReadable($propertyMetadata->isReadable() ?? false === $p['hidden']);
9393
}
9494

‎src/Laravel/workbench/app/Models/Book.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ class Book extends Model
8888
use HasFactory;
8989
use HasUlids;
9090

91-
protected $visible = ['name', 'author', 'isbn', 'publication_date', 'published', 'is_available'];
92-
protected $fillable = ['name', 'is_available'];
91+
protected $visible = ['name', 'author', 'isbn', 'publication_date', 'is_available', 'published'];
92+
protected $fillable = ['name', 'publication_date', 'isbn', 'is_available', 'published'];
9393
protected $casts = [
9494
'is_available' => 'boolean',
9595
];

‎src/Laravel/workbench/app/Models/Vault.php

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class Vault extends Model
4242
{
4343
use HasFactory;
4444

45+
protected $fillable = [
46+
'secret',
47+
];
48+
4549
public static function provide(): self
4650
{
4751
$v = new self();

0 commit comments

Comments
 (0)
Please sign in to comment.