久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      把laravel開(kāi)發(fā)中常用class的整合成一個(gè)包,避免每次重復(fù)復(fù)制粘貼

      下面由Laravel教程欄目給大家介紹如何把開(kāi)發(fā)中常用class的整合成了一個(gè)包,避免每次重復(fù)復(fù)制粘貼的方法,希望對(duì)需要的朋友有所幫助!

      laravel-quick

      laravel-quick(github 地址:https://github.com/youyingxiang/laravel-quick.git) 封裝了一些我們開(kāi)發(fā)中常見(jiàn)的工具,使開(kāi)發(fā)變得更高效

      • 主要包含翻譯了驗(yàn)證的語(yǔ)言包提示
      • 根據(jù) SymfonyComponentHttpFoundationResponse 為狀態(tài)碼的接口格式
      • 異常類處理
      • 集成基于 redis 的各種緩存操作
      • service,repository,trait的 artisan 命令生成;

      安裝

      • composer require yxx/laravel-quick
      • linux 和 mac
        php artisan vendor:publish --provider="Yxx\LaravelQuick\LaravelQuickServiceProvider"
      • windows
        php artisan vendor:publish --provider="YxxLaravelQuickLaravelQuickServiceProvider"

      怎么使用

      • 異常使用例子
        use YxxLaravelQuickExceptionsApiApiNotFoundException;// 請(qǐng)求參數(shù)錯(cuò)誤throw new ApiRequestException();// 404 未找到throw new ApiNotFoundException();// 系統(tǒng)錯(cuò)誤throw new ApiSystemException()// 未授權(quán)throw new ApiUnAuthException()自定義錯(cuò)誤繼承YxxLaravelQuickExceptions自己參照對(duì)應(yīng)代碼自定義
      • api 接口使用
        use YxxLaravelQuickTraitsJsonResponseTrait// 成功return $this->success("消息",['name'=>"張三"]);// 失敗return $this->error("錯(cuò)誤");// 自定義return $this->apiResponse(Response::HTTP_BAD_GATEWAY,"502錯(cuò)誤");
      • 緩存的使用(封裝了 redis 的一些方法)
        use YxxLaravelQuickFacadesCacheClient;CacheClient::hSet("test","1","張三");CacheClient::hGet("test","1");CacheClient::lPush("test","1");具體參考YxxLaravelQuickServicesCacheService里面的方法....

      artisan 命令

      • 創(chuàng)建 Trait php artisan quick:create-trait test
      • 創(chuàng)建 Service php artisan quick:create-service Test/TestService
      • 創(chuàng)建 Repository php artisan quick:create-repository Test

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)