承接 leandro-grg/list-maker 相关项目开发

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

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

leandro-grg/list-maker

Composer 安装命令:

composer require leandro-grg/list-maker

包简介

A template & db based list generator

README 文档

README

Installation

Require the package with composer

composer require leandro-grg/list-maker

Publish the vendor assets

php artisan vendor:publish --provider='LeandroGRG\ListMaker\Providers\ListMakerServiceProvider'

Add the provider to your application providers

return [
    //...
    'providers' => [
        //...
        LeandroGRG\ListMaker\Providers\ListMakerServiceProvider::class
    ]
    //...
];

Run the package migrations

php artisan migrate

(optional) Alias

You can alias the class by adding the next code snippet to your config/app.php

return [
    //...
    'aliases' => [
        //...
        'ListMaker' => LeandroGRG\ListMaker\ListGen::class
        //...
    ]
    //...
];

Usage

To use a list generator, you only need to write this in your view:

{{ ListMaker::make('list-name') }}

Also, you can use the package's custom blade directive:

@list('list-name')

If you won't to use it on a .blade.php file, you can use plain php

<?php LeandroGRG\ListMaker\ListGen::make('list-name') ?>

Creating lists

In order to create lists, just execute the command php artisan list:create-list, and follow the steps in the interactive cli tool. This will create an entry in the lists table, and the required folders: app/Helpers/ListTemplates directory.

Creating items

Run the command php artisan list:create-list-item. The command will prompt you for the the main list to add the new item. Once you select the list, it will prompt you for all the properties required for creating the item:

  • Type string required: The item type (item or divider)
  • Route string nullable: The item route.
  • Icon string nullable: The item icon
  • Display string required: The item display text
  • Order integer required: The order of the item

Templates

All the templates are located in the app/Helpers/ListTemplates directory. For each list, a directory is created in app/Helpers/ListTemplates/{StudlyCaseListName}.

Lists

Inside the app/Helpers/ListTemplates/{StudlyCaseListName} directory, you will find two relevant files for the lists:

  • Parser It's a generated class called {StudlyCaseListName}Parser.php with only one method, the parse method. It receives the $list (Illuminate\Database\Eloquent\Model) parameter, useful for replacing the strings in the template. The parse method returns an array to be used in the strtr php function.

  • Template Inside the folder, you can find a file called ListTemplate.html. That's the list template, you can modify it as you like.

List items

Basically, it works like the list parser, with a little difference:

  • Parser In this case, the parser will have a method for each type of item, following the pattern parse{Type}Type. For example, this will be the method for a divider type item:
static function parseDividerType ($item)
{
    return [];
}
  • Template And you can find the template for each type of item, in the list folder, following the next name pattern {ItemType}Template.html.

Adding custom item types

We're working on this. At the moment, you can use the item and divider item types.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固