定制 marshmallow/pages 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

marshmallow/pages

Composer 安装命令:

composer require marshmallow/pages

包简介

Deze package geeft de mogelijkheid om gemakkelijk pagina's te beheren in Laravel. Dit is eigelijk een verzameling van handinge composer packages van derde en samengevoegd om snel te kunnen hergebruiken.

关键字:

README 文档

README

alt text

Laravel Nova Pages

Version Total Downloads Issues Licence PHP Syntax Checker

This package provides you with the ability to easily create and manage pages and their content in Laravel Nova. It is essentially a curated bundle of handy Composer packages — both third-party and Marshmallow's own — combined so they can be reused quickly. The page body is built with marshmallow/nova-flexible layouts and is rendered to your front-end via a Blade view.

Requirements

The package pulls in a number of Marshmallow packages it builds on, including sluggable, seoable, translatable, redirectable, nova-flexible, nova-multiselect-field and nova-fontawesome. These are installed automatically via Composer.

Installation

Composer

You can install the package via composer:

composer require marshmallow/pages

Install for Nova 4

If you are using Nova 4, you can install the package using the command below.

composer require marshmallow/pages "^4.0"

Run the artisan command

Publish the configs from the Flexible package, migrate to create the pages table, create your Laravel Nova resource to manage your pages, and register the page routes in routes/web.php. This is all handled by a single install command:

php artisan pages:install

Under the hood pages:install publishes the package's assets, publishes the Flexible field assets, runs migrate, generates a Page Nova resource, and appends \Marshmallow\Pages\Facades\Page::routes(); to your routes/web.php.

Usage

You can add {!! Page::render($page) !!} to your blade file to render the layouts that are connected to the page. You can also loop through them yourself if that is helpful, like:

@foreach ($layouts as $layout)
    {{ $layout->render() }}
@endforeach

The Page facade also exposes a few helpers:

use Marshmallow\Pages\Facades\Page;

Page::routes();      // Register a route for every page (call this in routes/web.php)
Page::find($id);     // Retrieve a single cached page by its id

Add a new layout

You can generate new layouts via the command provided by the marshmallow/nova-flexible package that is included in this package. Run the command below to generate a new layout.

php artisan marshmallow:layout

Next you will need to add the newly generated layout to your flexible config.

/**
 * config/flexible.php
 */
return [
    /**
     * Your custom layouts. Please check the readme.md file for more
     * information about these custom layouts.
     */
    'layouts' => [
        'sluggable-name-of-your-layout' => \App\Flexible\Layouts\LayoutClassName::class
    ],
];

Configuration

After running pages:install (or publishing manually with php artisan vendor:publish --provider="Marshmallow\Pages\PagesServiceProvider"), the config file is available at config/pages.php. The available options are:

Key Default Description
database.connection null Database connection used for the pages table. null uses the default connection.
view marshmallow::layout The Blade view used to render a page.
wysiwyg env('NOVA_WYSIWYG', \Laravel\Nova\Fields\Trix::class) The Nova field class used for WYSIWYG content.
model \Marshmallow\Pages\Models\Page::class The Eloquent model representing a page. Override to use your own.
middleware \Marshmallow\Pages\Http\Middleware\PageMiddleware::class Middleware applied to every page route.
controller \Marshmallow\Pages\Http\Controllers\PageController@show The controller action that handles page requests.
nova_translatable_fields true Show the language selector when editing a resource in Laravel Nova.
share_page_to_view_data false When enabled, the full page is shared with all your view components.
use_multi_languages false Enable when using Marshmallow's Translatable package to load translated routes and resolve pages by a translated slug.
breadcrumb false Whether pages should be added to the Marshmallow Breadcrumb stack.
flexible_config [] Extra config loaded by the Flexible package to change its default behaviour.

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

If you discover any security related issues, please email stef@marshmallow.dev instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 12.78k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固