Skip to content

Commit

Permalink
fix(laravel): fix use laravel fillable for writable props (#6898)
Browse files Browse the repository at this point in the history
Closes: #6875
  • Loading branch information
toitzi authored Jan 9, 2025
1 parent a846079 commit deb2ed2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function create(string $resourceClass, string $property, array $options =

return $propertyMetadata
->withBuiltinTypes([$type])
->withWritable($propertyMetadata->isWritable() ?? true)
->withWritable($propertyMetadata->isWritable() ?? true === $p['fillable'])
->withReadable($propertyMetadata->isReadable() ?? false === $p['hidden']);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Laravel/workbench/app/Models/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class Book extends Model
use HasFactory;
use HasUlids;

protected $visible = ['name', 'author', 'isbn', 'publication_date', 'published', 'is_available'];
protected $fillable = ['name', 'is_available'];
protected $visible = ['name', 'author', 'isbn', 'publication_date', 'is_available', 'published'];
protected $fillable = ['name', 'publication_date', 'isbn', 'is_available', 'published'];
protected $casts = [
'is_available' => 'boolean',
];
Expand Down
4 changes: 4 additions & 0 deletions src/Laravel/workbench/app/Models/Vault.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class Vault extends Model
{
use HasFactory;

protected $fillable = [
'secret',
];

public static function provide(): self
{
$v = new self();
Expand Down

0 comments on commit deb2ed2

Please sign in to comment.