robertseghedi/laravel-autofetcher 问题修复 & 功能扩展

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

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

robertseghedi/laravel-autofetcher

Composer 安装命令:

composer require robertseghedi/laravel-autofetcher

包简介

This is a fresh Laravel plugin which gets data from your database, caches it and gets it ready for displaying on your amazing page. It is really simple to use, so it might not puzzle you.

README 文档

README

The most powerful and efficient Laravel plugin for proper data-fetching

This is a fresh Laravel plugin which gets data from your database, caches it and gets it ready for displaying on your amazing page. It is really simple to use, so it might not puzzle you.

Instalation

First, you have to install the package using composer in your project root folder:

composer require robertseghedi/laravel-autofetcher

Then, you have to add the provider to your config/app.php like that:

// your providers

RobertSeghedi\Autofetcher\AutofetcherProvider::class, 

Information

Command name What it does
Autofetch::database($table, $time - in seconds) Lists all the results from the table you mention
Autofetch::result($table, $type (first/last), $time - in seconds) Lists only the first/last result from the table you mention
Autofetch::select($table, $selected_fields, $time - in seconds) Lists all the results from the table you mention, but only the mentioned fields
Autofetch::top($table, $orderby, $number_of_results, $time - in seconds, $type) Lists all the results from the table you mention, but only the mentioned fields
Autofetch::lazy($table, $orderby, $number_of_results, $time - in seconds) Lazy-lists all the results from the table you mention, but only as much results as you mentioned

Usage

Now you can start using the package.

1. Include it in your controller

use RobertSeghedi\Autofetcher\Models\Autofetch;

2. Start extracting fresh data

public function fetch_table($table = null)
{
    $x = Autofetch::database($table);
    return $x;
}
public function fetch_top_donators($table = null)
{
    $x = Autofetch::top($table, 'donated_money', 10, 1800, 'public');
    return $x;
}
  • $table - the table's name that you want to extract data from
  • 'donated_money' - the order-by-field's name
  • 10 - number of results (so the above code will return a top 10)
  • 1800 - the number of seconds for which the data will be cached
  • 'public' - the public option is for efficient data-caching & displaying the data on a public website which doesn't require refresh-updated data. If you use the public option, your user-cached data won't refresh until the specified time is up. If you use the private option, your user-cached data will refresh instantly. The private option is good if you are developing an admin dashboard or a limited-access app.

3. Display it as you wish

Follow this package for future updates

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固