承接 wqa/nova-page-flexible-models 相关项目开发

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

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

wqa/nova-page-flexible-models

Composer 安装命令:

composer require wqa/nova-page-flexible-models

包简介

A Laravel Nova package to allow relating models as flexible content to pages

README 文档

README

A package for Laravel Nova which extends Nova Page and Nova Flexible Content and enables you to relate Laravel models to your Nova Pages using Flexible Content.

Testimonials example

Installation

composer require wqa/nova-page-flexible-models

Usage

In your page template class you must include the HasFlexibleModels trait.

To add a flexible model field, use the addFlexibleModelField method in your fields definition.

You can use the getFlexibleModels method to get the models back from the page. It's useful to do this using a helper method as shown below to keep your blade files clean.

class AboutPage extends Template
{
    use WQA\NovaPageFlexibleModels\HasFlexibleModels;

    public function fields(Request $request)
    {
        return [
            Panel::make('Tesimonials', [
                $this->addFlexibleModelField('Testimonials', 'testimonials', Testimonial::class, 'author'),
            ])
        ];
    }

    public function testimonials(): Collection
    {
        return $this->getFlexibleModels('testimonials', Testimonial::class);
    }
}

To access the testimonials in a blade view you can call the helper method as above which will give you a collection of whichever model you have specified.

@foreach (Page::testimonials() as $testimonial)
    <blockquote>
        {{ $testimonial->body }}
        <cite>{{ $testimonial->author }}</cite>
    </blockquote>
@endforeach

统计信息

  • 总下载量: 381
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固