Member Since 4 Years Ago

Experience Points 1,175
Experience Level 1

3,825 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 63
Best Reply Awards 0
Best Reply
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement


    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement


    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

20 Jun
8 months ago

lukeify started a new conversation Laravel Homestead-based Nginx/PHP Returns 500 After Several Hours Of Working Correctly

Hi all. I'm encountering an extremely frustrating problem running the homestead base box of 6.1.0 on Virtualbox 5.2.12 — in short, after several hours of a working php/laravel environment on the Homestead VM, I'll start getting timeouts and 500 errors when I try to access my application. I can still remotely login to the MySQL database over port 33060 (default), but nginx/php is just not responding — and I'd like to figure out why. What steps should I take to resolve this?

The only workaround I've found so far is to do a complete vagrant destroy --force and rebuild the VM, which takes upwards of 20 minutes and is not a livable solution.

Will happily provide more information as necessary.

13 Nov
3 years ago

lukeify started a new conversation Polling Returns Laravel 500 NotFoundHttpException

I'm trying to setup a node.js server, and it's not working.

Node.js code:

var app = require('express')();
var server = require('http').Server(app);

var io = require('')(server);

var redis = require('ioredis');
var Redis = new redis();


Redis.on('message', function(channel, message) {
    message = JSON.parse(message);

    console.log(channel, message);

io.on('connection', function() {

Serverside code:

var socket = io.connect('');

        socket.on('foo', function(data) {

All this does is triggers the following HTTP long polling requests in my client:

Server 500 error, #29 Symfony\Component\HttpKernel\Exception\NotFoundHttpException in /home/vagrant/myapp/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:161

What am I doing wrong?

13 Oct
3 years ago

lukeify started a new conversation Bidirectional Communication Between And Laravel?

Watching this video:, it occurred to me that the way Jeffrey is 'causing an action to occur' is through an HTTP request to a page (fetching the '/' page adds a user). When that request occurs, an event is broadcasted through Redis which is then send out to all listeners via

Is this not an example of one way websocket communication, rather than bidirectional communication? It is not using the websocket architecture to actually send data to the server, rather just noticing a HTTP request is being made and then sending data over the websocket protocol from the (Node.js) server -> client.

I guess what I'm really trying to ask is is there a way to achieve true bidirectional communication over websockets between the client and a PHP server? i.e., a websocket request (not an HTTP request) goes to the PHP server, which then manipulates it and can broadcast an event back to any clients.

Consider this example: imagine a commentator annotating a video livestream, with viewers both watching the video and recieving updates from the commentator.

Can the Commentator make an update over the websocket protocol to the PHP server, rather than making a POST request over the HTTP protocol to the PHP server?

02 Mar
3 years ago

lukeify started a new conversation Bashrc & Getting Off MAMP

So I want to get off MAMP, and Jeremy is making it seem like Vagrant is the way to go. He says it's super simple. But 2 minutes into it, I'm already lost.

Step 2 is to add an alias to a ~/.bashrc file. Cool.

The only problem is, whatever he does over the next 30 seconds is pretty much voodoo wizardry to me. I don't get it. It goes too quickly. And he starts meandering off about aliases.

I don't use Vim/vi whatever it is, I run on a Mac, I have no idea which bashrc is. Can someone tell me, step by step, in plain human readable English, how I can add that snippet of text linked in the video to my bashrc file?

24 Jan
4 years ago

lukeify started a new conversation How To Force Laravel Eloquent To Play Nicely With A Query Which Returns No Results?

I have a database query set up as a scoped query in one of my models, where in some instances no results may be returned, and it's perfectly fine for it to do so:

public function scopeLastFromLaunchSite($query, $site) {
    return $query->whereComplete()->whereHas('launchSite', function($q) use($site) {

This query works perfectly fine if there is at least one row in the result, but as soon as there is none, it returns a hugely lengthy Builder object that is filled with recursions which essentially crashes my browser.

My question is...

How can I detect this and simply return something like false or "No results were found."?

What I've tried...

I've tried using the firstOrFail() method in place of first(), but that simply returns a ModelNotFoundException which gives me two solutions:

  1. Handle it in global.php with App:error. This is not preferable as no returned results is not an error. Just one of the many possible outcomes.

  2. Catch the exception in each method, which results in code duplication. I've actually been unable to get this to work either. I try using the ModelNotFoundException class and catching it, but it never gets caught:

    use Illuminate\Database\Eloquent\ModelNotFoundException;
    // ...
    try {
        //my query
    } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
        return false;
    // otherwise, return as normal

How can I simply return false or some falsey value when a query on my model returns no results, instead of simply printing out this hugely lengthy error?

23 Jan
4 years ago

lukeify started a new conversation Responsibility: Where Does $this->user Come From?

While watching the Controller Responsibility video, he placed the Validation into a method on the User model at about 5:15. He references the validation with $this->user without instantiating a User. If I attempt to do the exact same thing, I get the message:

Undefined property: UsersController::$user

Additionally, if the validation fails, he seemingly grabs the errors directly from the uninstantiated user, $this->user->getErrors().

How is this possible? Is this just demonstrating how validation in the model might work, and I actually do have to instantiate the user? Or should I make my validation method static?

21 Jan
4 years ago

lukeify started a new conversation Create A Eloquent Relationship Between A Parent Table And A Lookup Table?

I'm using Laravel 4.2 and I'm slowly building a complex website, and I've come across a relationship between two of my tables that I cannot immediately figure out how to map together with Eloquent. Here is the relevant schema:

table `missions`
mission_id (PK) | name           | launch_site_id (FK)
1              | someMission    | 1
2              | anotherMission | 3
3              | moreMissions   | 1

table `launch_sites`
launch_site_id (PK) | name   | location
1                  | Kwaj    | <some coordinate>
2                  | Florida | <some coordinate>
3                  | Russia  | <some coordinate>

As you can see, the table launch_sites is a lookup table for missions, and each mission has a single launch site (guaranteed).

I tried representing this with a hasOne & belongsTo relationship in Eloquent ORM:

class Mission extends Eloquent {
    public function launchSite() {
        return $this->hasOne('LaunchSite');

class LaunchSite extends Eloquent {
    protected $table = 'launch_sites';

    public function mission() {
        return $this->belongsTo('mission');

However, I quickly realized this would not work as a launch site does not "belong to" a mission. With this relationship, I get the error:

Column not found: 1054 Unknown column 'launch_sites.mission_id' in 'where clause' (SQL: select * from launch_sites where launch_sites.mission_id = 3 limit 1)

What relationship setup in Eloquent do I want so I can correctly query and fetch the launch site from a mission like so?

Mission::{{Some Query}}->with('launchSite'); 
18 Jan
4 years ago

lukeify left a reply on Translating A One To One Join SQL Query Into Laravel's Eloquent Syntax

Hey henrique, that worked perfectly. Thanks!

17 Jan
4 years ago

lukeify started a new conversation Translating A One To One Join SQL Query Into Laravel's Eloquent Syntax

I need some help translating the following query I have into Eloquent:

SELECT vehicles.vehicle, COUNT(vehicles.vehicle) AS vehiclecount 
FROM vehicles 
INNER JOIN missions ON missions.mission_id=vehicles.vehicle_id 
WHERE missions.status='Complete' GROUP BY vehicles.vehicle

This, for example, will output the following result:

vehicle  | vehiclecount
Falcon 9 | 3
FH       | 1

I already have both my Mission and Vehicle models linked with a one to one relationship:

class Vehicle extends Eloquent {
    public function mission() {
       return $this->belongsTo('Mission');

class Mission extends Eloquent {
    public function vehicle() {
        return $this->hasOne('Vehicle');

I am sure this query will either involve the use of the whereHas or selectRaw method, but I so far have been unable to correctly chain the correct methods together to produce the result I need.

16 Jan
4 years ago

lukeify started a new conversation View Presenters. Why Am I Failing At This?

I'm trying to follow the "View Presenters" video, and I'm getting stuck on some of the final steps.

Firstly, my directory structure is the following:



In my presenter, I have a name method which should format the name as I like:

class StatisticPresenter {
public function name() {
    return $this->entity->name . ' | Some Presentation';

Yet, when called, Laravel gives me the error Undefined property: StatisticPresenter::$entity.

Why is this? Where does entity come from, anyway?

21 Oct
4 years ago

lukeify left a reply on Marked As Watched Not Working

Same here. I can't seem to get videos I have watched to be marked as complete.