Fork me on GitHub

DataView

You can extend Rapyd "AbstractDataView" to make custom {Entity}View to display filter and paginate custom datasets.
todo..


Article Detail

Title
Culpa porro sint minus sequi qui aliquam.
Author
Angelita Carroll

route



     Route
::get('/article/view/{article:id}'ArticlesView::class)
        ->
name('articles.view')
        ->
crumbs(fn ($trail$article) => $trail->parent('articles')->push('View Article'route('articles.view'$article)));

component

Http/Livewire/ArticlesView.php


<?php

namespace App\Http\Livewire;

use 
App\Models\Article;
use 
Zofe\Rapyd\Http\Livewire\AbstractDataView;


class 
ArticlesView extends AbstractDataView
{
    public 
$article;

    public function 
mount(Article $article)
    {
        
$this->article $article;
    }

    public function 
render()
    {
        return 
view('livewire.articles.view');
    }
}

view

../resources/views/livewire/articles/view.blade.php



    
<x-rpd::view title="Article Detail">

        <
x-slot name="buttons">
            <
a href="{{ route('articles') }}" class="btn btn-outline-primary">list</a>
            <
a href="{{ route('articles.edit',$article->id) }}" class="btn btn-outline-primary">edit</a>
        </
x-slot>

        <
dl class="row">
            <
dt class="col-3">Title</dt>
            <
dd class="col-9">{{ $article->title }}</dd>
            <
dt class="col-3">Author</dt>
            <
dd class="col-9">{{ $article->author->firstname }} {{ $article->author->lastname }}</dd>
        </
dl>

    </
x-rpd::view>