Articles with tag - laravel

Validate slack slash commands via signing secret

Posted on 2 years ago by Ping Cheng

Here is a gist for validating the slack slash command via the slack signing secret.

The sample is for Laravel middleware. Since the validation process is written below, you can modify to suit your project.

GitHub gist:


namespace App\Http\Middleware;
use Exception;
use Carbon\Carbon;
use Closure;
use Illuminate\Support\Facades\Log;

class SlackRequest
     * Validate a slack request
     * by the slack signing secret (not the token)
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @return mixed
     * @throws Exception
    public function handle($request, Closure $next)
        // define the version number
        $version = 'v0';

        // load the secret, you also can load it from env(YOUR_OWN_SLACK_SECRET)
        $secret = config('services.slack.signing_secret');



[ Read More ]

Use Tailwind in Laravel

Posted on 1 year ago by Ping Cheng

Tailwind a very low-level CSS framework that only includes classes but does not contain any pre-defined components. This means you can define your own component styles without override the styles come with the CSS framework.

To have a better understanding of Tailwind, please read the official website:

Here are the steps that integrates the tailwind into your Laravel project:


First, let's install the tailwind itself

# Using npm
npm install tailwindcss

# Using Yarn
yarn add tailwindcss

Then, let's install the PurgeCSS to cut off classes that we did not use to save our final css file size

# Using npm
npm install laravel-mix-purgecss --save-dev

# Using Yarn
yarn add laravel-mix-purgecss --dev

Create a configuration file

npx tailwind init

After ran the above command, you will find tailwind.config.js was generated on your project root directory.

Import Tailwind



[ Read More ]

Hand crafted with by Ping Cheng