Skip to content
Advertisement

Tag: laravel

How to only use created_at in Laravel

I want only use created_at , how to do it? I know: This can custom timestamps name This can disable timestamps Answer Eloquent does not provide such functionality out of the box, but you can create it on your own using the creating event callback:

Guzzle returns cURL error 3: malformed

I want to try out the guzzle library and am following through their quickstart tutorial to make http requests to an api. Yet it doesn’t seem to work, because I get the following error: Since I have never worked with cURL before, I don’t even know how to respond to that error message. Here is my code with the request

Laravel sort collection and then by key

I am making raking system for my users and here’s what I have so far: Get all users and sort them by points – it works fine. $users = User::all(); $users = $users->sortByDesc(function($item){ …

Mocking classes that created with app()->make

I have this code in my __construrct: Now, when i’m unit testing i know that i can mock Guard and pass it’s mock to $auth, but how can i mock dbUserService ? it’s instantiated trough the IoC container. Answer You can use the instance() method of the IoC container to mock any class instanciated with make():

Php-ffmpeg “Unknown encoder libfaac” on Windows

I am using laravel 4.2. I am working on a project in that user can upload a video and I need to transcode it that it can be played over all kind of devices. For transcoding I have added php-ffmpeg package from git hub in my project. According to the instructions I have downloaded ffmpeg package from http://ffmpeg.zeranoe.com/builds and set

How to join three table by laravel eloquent model

I have three table Articles table Categories table User table I want to show articles with their category name instead of category_id and user_name instead of user_id I try like these query It is work! But I want to do by Eloquent way. Please, how could I do? Answer With Eloquent it’s very easy to retrieve relational data. Check out

Advertisement