定制 torann/cells 二次开发

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

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

torann/cells

Composer 安装命令:

composer require torann/cells

包简介

Cells are view components for Laravel 4. They are mini-controllers with their own MVC stack, can invoke logic and render views.

README 文档

README

Latest Stable Version Total Downloads

Cells are view components for Laravel 4. They are mini-controllers with their own MVC stack, can invoke logic and render views.

Installation

To get the latest version of Cells simply require it in your composer.json file.

"torann/cells": "dev-master"

You'll then need to run composer install to download it and have the autoloader updated.

Once Cells is installed you need to register the service provider with the application. Open up app/config/app.php and find the providers key.

'providers' => array(

    'Torann\Cells\CellsServiceProvider',

)

Cells also ships with a facade which provides the static syntax for creating collections. You can register the facade in the aliases key of your app/config/app.php file.

'aliases' => array(

    'Cells' => 'Torann\Cells\Facades\CellsFacade',

)

Create configuration file using artisan

$ php artisan config:publish torann/cells

Creating a cell

You can create a cell using artisan command:

php artisan cells:create demo

The parameter is the cell name.

Now you will see a controller class at /app/cells/CellDemo.php and view at /app/cells/demo/display.blade.php

Rendering

Using the Blade helper

@cell('demo', 'display')
  • The first parameter is the cell name.
  • The second parameter is the view type, by default it is "display".

Calling your cell in a view and passing Demo Cell! as the label

echo Cells::get('demo', 'display', array('label' => 'Demo Cell!'));

Caching

Cells can be cached based on minutes. Simple change the $cache variable in the cell controller to the number of minutes the cell should be cached.

class CellDemo extends CellBaseController {

    /**
     * Default cache value in minutes.
     *
     * @var string
     */
    public $cache = 60;

}

By default caching is disabled in the local environment. To enable this change the setting disable_cache_in_dev to false in the config file.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD
  • 更新时间: 2013-10-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固