netflex/pages

Netflex Pages 库

v5.0.2 2024-08-16 15:57 UTC

This package is auto-updated.

Last update: 2024-09-16 16:10:27 UTC


README

Stable version Build status License: MIT Contributors Downloads

[只读] Netflex Pages 组件的子树拆分(参见 netflex/framework

Eloquent 兼容的模型,用于与 Netflex Pages 一起工作。

Stable version License: MIT Downloads

安装

composer require netflex/pages

生成配置文件

php artisan vendor:publish --tag=config

配置自定义媒体预设

<?php

use Netflex\Pages\Components\Picture;

/**
 *
 */
return [
    'breakpoints' => [
        'xss' => 320,
        'xs' => 480,
        'sm' => 768,
        'md' => 992,
        'lg' => 1200,
        'xl' => 1440,
        'xxl' => 1920,
    ],

    'presets' => [
        'default' => [
            'mode' => Picture::MODE_ORIGINAL,
            'resolutions' => ['1x', '2x'],
        ],

        'banner' => [
          'mode' => Picture::MODE_LANDSCAPE,
          'resolutions' => ['1x', '2x'],
          'size' => [1920, 600],
          // Customize config per breakpoint:
          'breakpoints' => [
            'md' => [
              'mode' => Picture::MODE_FIT,
              'resolutions' => ['1x'].
            ],
            'lg' => 'md', // Aliasing 'lg' breakpoint to 'md'
          ]
        ],
    ],
];

示例用法

<?php

use Netflex\Pages\Page;

$page = Page::find(10000);

$slug = 'top-10-tricks-for-working-with-netflex';
$pageForUrl = Page::resolve($slug);

$firstPage = Page::first();
$lastPage = Page::last();

$newestPage = Page::orderBy('updated', 'desc')->first();

$freshPage = new Page([
  'name' => 'Fresh new article',
  'author' => 'John Doe',
  'content' => '<h1>Hello world!</h1>'
]);

$freshPage->save();

贡献

感谢您考虑为 Netflex Pages 做贡献!请阅读贡献指南

行为准则

为了确保社区对所有成员都友好,请查阅并遵守行为准则

许可证

Netflex Pages 是开源软件,采用MIT 许可证

版权所有 © 2020 Apility AS