Skip to content

Commit 6a8d206

Browse files
toitzijonerickson
authored andcommitted
fix(laravel): fix use laravel fillable for writable props (api-platform#6898)
Closes: api-platform#6875
1 parent a971944 commit 6a8d206

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
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/Vault.php

Lines changed: 4 additions & 0 deletions
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)