mateusztumatek/nova-model-link-field
最新稳定版本:1.0.1
Composer 安装命令:
composer require mateusztumatek/nova-model-link-field
包简介
A Laravel Nova field.
README 文档
README
Search models and append links to this models by nova field
This field allow to fill database "link" column with link to Application Model
Scenario You have 4 models Product, Category, Blog, Order and also you have model Post with fields "name", 'link' .... You want have post with attached link to Product or Category etc.. In normal way, you have to create product_id or category_id ... But you only need link. Thats why this field comes in. You can attach link to multiple models with search functionality
INSTALLATION
composer require mateusztumatek/nova-model-link-field
Basic usage
Add NovaIsLinkableContract to your models that should be linkable
Example :
class Product extends Model implements NovaIsLinkableContract{ /** * Generate link for nova link field * @return string */ public function novaLink(): string { return route('products.show', ['product' => $this->id]); } }
And in your resource file
public function fields(NovaRequest $request) { return [ NovaModelLinkField::make('Link', 'link') ]; }
If you want keep relative path to your application url you can use
NovaModelLinkField::make('Link', 'link')->storeType('relative')
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-22