Laravel Queue: Job Class demystified (ShouldQueue, Dispatchable, InteractsWithQueue, Queueable, SerializesModels)

Laravel is awesome, but personally I don’t appreciate their documentation as it seems always “beginner orientated”.

They trend make simple things automagically happen, without let you knowing how it works.

They you get into trouble when you need advanced functionality.

Say, you get this boilerplate when typing php artisan make:job TestJob:

So, what actually are ShouldQueue, Dispatchable, InteractsWithQueue, Queueable, SerializesModels?
Documentation won’t tell you, even if you read the API Reference, you have little idea what they means.

Continue reading “Laravel Queue: Job Class demystified (ShouldQueue, Dispatchable, InteractsWithQueue, Queueable, SerializesModels)”

[Windows] Laravel behaving strange on Windows Server

You likely encounter those problem when developing Laravel Application using Windows Machine.


  • Frequent Apache Crash (Connection reset)
  • “Access denied for user ‘homestead’@’localhost’ (using password: YES)”, even .env is set to different credential
  • .env setting drifting between two separate Laravel installations  (e.g. .env setting applied to

Continue reading “[Windows] Laravel behaving strange on Windows Server”

Change public path in Laravel 5.*

Most shared host use public_html instead of public,
While sometimes considered bad practice, some client may force you to drop-in everything via FTP

There are several ways to change public folder name found on Google.

But most of them won’t work perfectly.

  1. In AppServiceProvider.php, bind ‘path.public’ to IoC container
    Won’t work in console, vendor:publish still publish in public path
  2. In index.php, bind ‘path.public’ to IoC container
    Works in console, but artisan serve still won’t work

After dig down deep in the source code, I found the cause:

The publicPath() method in Illuminate\Foundation\Application
is hardcoded.

But we should never hard the core, so let’s override this method on our own class.

Continue reading “Change public path in Laravel 5.*”