Passing variable from Laravel to VueJS 2 component

tl;dr:
Use   for Blade and    for component.
Beware of using    for content contains    and  .

Recently I write a lot of Laravel and VueJS 2 then faced with the common case when want to pass PHP variables to VueJS component.
There are a lot of proposed methods including pass as global JS variables, pass as a slot, and pass as a props.
Each one has its own advantages and disadvantages here I will explain.

Continue reading

Rewrite Laravel URL when not in root path with NGINX

In the most cases, we place the Laravel in the root path /.

As a result, the nginx configuration becomes

However, if we want to move Laravel inside other directories, we must also change the location directive along with the public/index.php file.

Let’s say we want to move to the /app directory. Then the location directive would become

Since nginx indicates the root path already, so we have to always refer from the root path.