承接 markrassamni/nova-resource-landing-page 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

markrassamni/nova-resource-landing-page

最新稳定版本:v3.0.0

Composer 安装命令:

composer require markrassamni/nova-resource-landing-page

包简介

Decide if a resource should open on the index, create, update, or detail page

README 文档

README

License Latest Version on Packagist Total Downloads

Adds the ability to create a navigation link directly to the detail, create, or edit page of a resource.

Prerequisites

Installation

$ composer require markrassamni/nova-resource-landing-page 

Modify app/Nova/Resource.php to implement ResourceLandingPageInterface and the SupportChangeResourceLandingPage trait:

<?php namespace App\Nova; use MarkRassamni\NovaResourceLandingPage\Traits\SupportChangeResourceLandingPage; use MarkRassamni\NovaResourceLandingPage\Contracts\ResourceLandingPageInterface; use Laravel\Nova\Resource as NovaResource; abstract class Resource extends NovaResource implements ResourceLandingPageInterface { use SupportChangeResourceLandingPage; ... }

Publish assets:

$ php artisan vendor:publish --provider="MarkRassamni\NovaResourceLandingPage\Providers\NovaResourceLandingPageServiceProvider" 

Update

When updating it is important to republish the assets, like so:

$ php artisan vendor:publish --force --provider="MarkRassamni\NovaResourceLandingPage\Providers\NovaResourceLandingPageServiceProvider" 

Uninstallation

Remove from composer

$ composer remove markrassamni/nova-resource-landing-page 

Remove SupportChangeResourceLandingPage trait from your Nova Resources

use SupportChangeResourceLandingPage; 

Remove the customized navigation template

rm resources/views/vendor/nova/resources/navigation.blade.php 

Usage

Place the following method on models that should land on the detail page.

class MyResource extends Resource { public static function detail(): bool { return true; } }

Place the following method on models that should land on the create page.

class MyResource extends Resource { public static function create(): bool { return true; } }

Place the following method on models that should land on the edit page.

class MyResource extends Resource { public static function edit(): bool { return true; } }

Optionally override the resource identifier when opening the detail or edit page.

class MyResource extends Resource { /**  * @return string|int  */ public static function recordId() { return 1; } }

How it works

Laravel Nova has the ability to override the Blade template used to render the navigation sidebar. The template is copied from Nova version v3.4.1 and altered with a few lines to support linking a resource directly to the detail view. When publishing vendor assets with the tag nova-views the template will be placed in the project resources/views/vendor/nova/resources folder.

View changes
@if ($resource::detail()) <router-link :to="{ name: 'detail', params: { resourceName: '{{ $resource::uriKey() }}', resourceId: {{ $resource::recordId() }} } }" class="text-white text-justify no-underline dim"> {{ $resource::label() }} </router-link> @elseif ($resource::create()) <router-link :to="{ name: 'create', params: { resourceName: '{{ $resource::uriKey() }}', } }" class="text-white text-justify no-underline dim"> {{ $resource::label() }} </router-link> @elseif ($resource::edit()) <router-link :to="{ name: 'edit', params: { resourceName: '{{ $resource::uriKey() }}', resourceId: {{ $resource::recordId() }} } }" class="text-white text-justify no-underline dim"> {{ $resource::label() }} </router-link> @else <router-link :to="{ name: 'index', params: { resourceName: '{{ $resource::uriKey() }}' } }" class="text-white text-justify no-underline dim"> {{ $resource::label() }} </router-link> @endif

统计信息

  • 总下载量: 43.22k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 9
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固