PHP code example of markrassamni / nova-resource-landing-page

1. Go to this page and download the library: Download markrassamni/nova-resource-landing-page library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

markrassamni / nova-resource-landing-page example snippets




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;

    ...
}

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

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

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

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

@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

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

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