Just set the memory_limit specifying the full route of your composer.phar file and update if you got the out of memory error when running composer require.

php -d memory_limit=-1 [composer_phar_file_path] update

I hope it can help you :)

In previous versions, to define a custom validation rule, you must to implement the Illuminate\Contracts\Validation\Rule interface or use a Closure.

As below code, a custom rule StrongPassword like so.

namespace App\Rules;use Illuminate\Contracts\Validation\Rule;class StrongPassword implements Rule
public function passes($attribute, $value)
return preg_match("/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@()$%^&*=_{}[\]:;\"'|\\<>,.\/~`±§+-]).{12,30}$/", $value);
public function message()
return 'The :attribute must be 12–30 characters, and include a number, a symbol, a lower and a upper case letter';

And use it in your controller or request validation.

namespace App\Http\Requests;use App\Rules\StrongPassword;
use Illuminate\Foundation\Http\FormRequest;
class AccountRequest extends FormRequest
public function authorize()
return true;

We will build a custom authentication guard allowing admin to login and logout separately from the default user guard.

First, we will create Admin model and migration by artisan:

php artisan make:model Models\Admin -m

Add code into database/migrations/XXXX_XX_XX_XXXXXX_create_admins_table.php

<?phpuse Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminsTable extends Migration
public function up()
Schema::create('admins', function (Blueprint $table) {

From Laravel 8.27 you can add multiple new columns after an existing column at the same time.

In previously, it isn’t difficult to write, you’d have to call after() method for each subsequent new column.

Schema::table('customers', function ($table) {

From version 8.27 you can group them in a new after() method on the Blueprint migration instance.

Schema::table('customers', function ($table) {
$table->after('password', function ($table) {

In this article, let’s create a Laravel 8 project with Docker on MacOS

Install Docker Desktop on Mac

Reference: https://docs.docker.com/docker-for-mac/install/

Check Docker and Docker-Compose version

docker -vdocker-compose -v

Create some files and folders with following structure

- project
— nginx
— — default.conf
— src
— docker-compose.yml
— php.dockerfile
— upload.ini

Configure NGINX for project in project/nginx/default.conf

server {
listen 80;
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php; …

In this article, let’s learn how to create a custom helper class in Laravel 7.

First step, create a app\Utilities folder.

Next, create a app\Utilities\SiteHelper.php file.

Then add following code into that file

<?phpnamespace App\Utilities;class SiteHelper
public static function slug(string $str): string
$str = self::stripVnUnicode($str);
$str = preg_replace('/[^A-Za-z0-9-]/', ' ', $str);
$str = preg_replace('/ +/', ' ', $str);
$str = trim($str);
$str = str_replace(' ', '-', $str);
$str = preg_replace('/-+/', '-', $str);
$str= preg_replace("/-$/", '', $str);
return strtolower($str);
public static function stripVnUnicode(string $str): string

We will integrate CKFinder 3 package with CKEditor 4 for Laravel 7 in this article

Add a Composer dependency and install the package

composer require ckfinder/ckfinder-laravel-package

After installing the Laravel package you need to download CKFinder code. It is not shipped with the package due to different license terms. To install it, run the following artisan command:

php artisan ckfinder:download

It will download the required code and place it inside an appropriate directory of the package (vendor/ckfinder/ckfinder-laravel-package/).

Publish the CKFinder connector configuration and assets.

php artisan vendor:publish --tag=ckfinder-assets --tag=ckfinder-config

This will publish CKFinder assets to public/js/ckfinder, and the CKFinder connector…

The idea is that I’m fetching table values (also caching it) and made a SettingServiceProvider to be able to access it as a configuration variable later on.

First, we need to create Setting model and migration by following artisan

php artisan make:model Models\Setting -m

Configure for Setting migration file

// database\migration\xxxx_xx_xx_xxxxxx_create_settings_table.phpuse Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSettingsTable extends Migration
* Run the migrations.
* @return void
public function up()
Schema::create('settings', function (Blueprint $table) {
* Reverse the migrations…

Now, we will learn how create symbolic link in a shared hosting using PHP

In Laravel documentation, a symbolic link (symlink or soft link) from public/storage to storage/app/public should be created to make files accessible from the web.

Create a symlink.php file:

<?php$targetFolder = '/home/your_account/your_project_src/storage/app/public';
$linkFolder = '/home/your_account/your_domain.com/storage';
symlink($targetFolder, $linkFolder);
echo 'Symlink process successfully completed';

Upload to public_html or your domain folder and run this symlink.php file:


Done! A folder named storage will be created to link path with an indicator >>> on the folder icon.

Happy Coding:)

In this post, let’s learn how to setup an .htaccess file for redirecting to Laravel’s public folder.

In Laravel the path for serving your web page is in the /public folder. By default after installing Laravel and navigating in a browser to the URL you will see a directory listing of all the Laravel files. Here’s an easy way using an .htaccess file to redirect requests of user to the Laravel /public folder mod_rewrite.

Create a .htaccess file in your root directory and add the following code.

<IfModule mod_rewrite.c>
# That was ONLY to protect you from 500 errors
# if your…

Trung Vu

Full-Stack web developer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store