dromedar-design/laravel-prismic 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dromedar-design/laravel-prismic

Composer 安装命令:

composer require dromedar-design/laravel-prismic

包简介

Automatic Eloquent models and better templating for Prismic

README 文档

README

Automatic Eloquent models and better templating for Prismic

Installation

You can install the package via composer:

composer require dromedar-design/laravel-prismic

Then you can configure it as a new database connection in config/database.php:

'connections' => [

    'prismic' => [
        'driver' => 'prismic',
        'database' => 'https://XXX.cdn.prismic.io/api/v2',
        'cache' => false,
    ],
    
    // other connections
],

After this you only have to extend the Model shipped with the package and your Prismic api works like a usual Eloquent model.

<?php

namespace App;

use DromedarDesign\Prismic\Model;

class Post extends Model
{
    //
}

Relationships

Relationships work as you would expect it from regular Eloquent models.

Accessing properties

There are three output modes:

  • raw
  • text
  • html (this is the default)
$post = \App\Post::first();

$title = $post->title; // By default it returns the html output

// Output: <h1>Hello, this is title</h1>

You can either access other modes directly or change the default.

$title = $post->title->text;

// Output: Hello, this is title

$post->setPrismicMode('raw');
$title = $post->title;

/** Output:
 *  [
 *      {
 *          "type": "heading1",
 *          "text": "Hello, this is title",
 *          "spans": []
 *      }
 *  ]
 */

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固