Skip to content

Commit

Permalink
WIP test
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Sep 26, 2024
1 parent 7fbe661 commit 1897a8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ public function create(string $resourceClass, array $options = []): PropertyName
return $this->decorated?->create($resourceClass, $options) ?? new PropertyNameCollection();
}


/**
* @var array<string, true> $properties
*/
$properties = [];

/**
/*
* When it's an Eloquent model we read attributes from database
* @see \Illuminate\Database\Console\ShowModelCommand
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Laravel/workbench/app/Models/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Book extends Model
use HasFactory;
use HasUlids;

protected $visible = ['name', 'author', 'isbn', 'publication_date'];
protected $visible = ['name', 'slug', 'author', 'isbn', 'publication_date'];
protected $fillable = ['name'];

public function author(): BelongsTo
Expand All @@ -73,8 +73,8 @@ public function author(): BelongsTo
}

// Virtual field
public function getTitleAttribute(): string
public function getSlugAttribute(): string
{
return Str::title($this->name);
return Str::slug($this->name);
}
}

0 comments on commit 1897a8b

Please sign in to comment.