laravel-5.1

    0熱度

    1回答

    我似乎無法摸不着頭腦,因爲MySQL的是不是我的強項。我在這裏做了一些研究,但不能把兩個和兩個放在一起,所以我轉向社區尋求幫助。 我建設我的Laravel應用程序內聊天功能,其中兩個用戶可以互相交談。我無法弄清楚如何構建收件箱(將對話分組在一起)。我已經想出瞭如何通過發送它來分組最後的消息。 ,以下是我User模型內部: public function lastMessages() {

    -4熱度

    2回答

    好,現在,我想獲得SQL就像: select field1,field2,field3 from orders inner join (select id from orders where field4=3 limit 1000, 20) as temp using(id) 我怎麼能由laravel 5.1弄來的? 呃,對不起我英語不好。我的意思是我想要得到像這樣的原生SQL,現

    -1熱度

    1回答

    我正在構建我的網站的聊天部分,這裏是我提出的用於檢索收件箱和對話的最後一條消息的查詢。 $chat_inbox = Message::where('author_id', $this->user->id) ->orWhere('recipient_id', $this->user->id) ->groupBy('unique_chat_id') ->lates

    0熱度

    1回答

    我有以下關係: 作業有很多角色。 public function roles() { return $this->hasMany(Role::class); } 角色有許多班次和通過班次分配。 public function shifts() { return $this->hasMany(Shift::class); } public function ass

    2熱度

    1回答

    在我的網站上,我使用Laravel的created_at來存儲圖像上傳的時間。 但是,我希望能夠創建一個只在特定時間範圍內獲取圖像的查詢。 這些將是: -The過去24小時 -The過去一週 -The過去一個月 -The路徑年 我在想東西像... $images = Images::where('created_at', '>=', Carbon::now()->hours(24))->get()

    1熱度

    1回答

    我有以下兩個集合: $credits = collect([ ['quantity' => 3, 'product_id' => 1], ['quantity' => 2, 'product_id' => 5] ]); $basketItems = collect([ ['id' => 1, 'basket_id' => 4, 'product_id' => 1

    0熱度

    1回答

    我正在嘗試在網站上用戶上傳圖片的無限滾動(based on this tutorial)。當我使用我網站上的所有圖像時,無限滾動工作得很好,但是當我改進查詢時,事情開始變得越來越麻煩。 出於測試目的,我有12個圖像。他們都有一個「種類」字段,標題等。 這些圖像的標題爲:vector1,vector2,vector3,drawing1,drawing2,drawing3,drawing4,inter

    1熱度

    3回答

    目前,當我轉換一個模型爲JSON,所有的碳日期字段鑄像這樣: "end_time": { "date": "2017-02-03 23:59:00.000000", "timezone_type": 3, "timezone": "Europe/London" } 我希望它使用Atom符號鑄造。 這可以在碳做到像這樣: $order->end_time->toA

    1熱度

    1回答

    最近我正在檢查我的Web應用程序加載速度(它是使用Laravel 5.1構建的)。我碰到了Leverage browser caching。所以我用Google搜索它來找到解決方案,但它似乎並沒有工作。 有人提到添加以下代碼: <IfModule mod_expires.c> ExpiresActive on # Perhaps better to whitelist expires

    7熱度

    2回答

    我使用laravel緩存(該remember()法)這樣的代碼: $postedItems = Cache::remember('home_posted_items', $this->cacheTimes['postedItems'], function() { /* the stuff that prepares data */ return ['items' => $i