承接 hobbiot/cacheable-auth-user 相关项目开发

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

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

hobbiot/cacheable-auth-user

Composer 安装命令:

composer require hobbiot/cacheable-auth-user

包简介

Cache Auth::user() for Laravel 5.3. This package add new driver to laravel.

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Cacheable Auth::user() for Laravel 5.3 or 5.4.

Installation

Composer

composer require hobbiot/cacheable-auth-user

Laravel

app.php

In your config/app.php add HobbIoT\Auth\CacheableAuthUserServiceProvider::class to the end of the providers array:

'providers' => [
    ...
        HobbIoT\Auth\CacheableAuthUserServiceProvider::class,
    ...
],

auth.php

In your config/auth.php change User Providers' driver. You can now use "cacheableEloquent".

...
    'providers' => [
        'users' => [
            'driver' => 'cacheableEloquent',
            'model' => App\User::class,
        ],
		// e.g.
        'admin' => [
            'driver' => 'cacheableEloquent',
            'model' => App\Administrator::class,
        ],
    ],
...
],

Administrator::class needs to extend Authenticatable (Illuminate\Foundation\Auth\User) and use trait Notifiable (Illuminate\Notifications\Notifiable), just like App\User::class.

Supplementary Explanation

  • The cache is valid for 60 minutes.

  • The cache Key is ModelClassName_By_Id_id and ModelClassName_By_Id_Token_id.

  • Using Eloquent updated event listener to clear cache, need to use model->save(). When user update his name in profile page, fire updated event automatically, (listen event and) clear cache. After that reload from resources (database).

    Laravel Official Documentation said,

Note: When issuing a mass update via Eloquent, the saved and updated model events will not be fired for the updated models. This is because the models are never actually retrieved when issuing a mass update.

统计信息

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

GitHub 信息

  • Stars: 12
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固