Photo by Benjamin Voros on Unsplash

Assalamualaikum / Hi,

My first experience on CentOS is on my first job after graduation — 2009 and it’s about 2 years plus experience on CentOS at that time. Never really had an idea what I’m working on during that noob era, LOL.

Anyway, 2019, just a quick run through the LAM stack installation on CentOS 7. LAMP stands for Linux, Apache, MySQL and PHP.

And there is some additional setup that required for web development.

Redis is an open-source in-memory data structure project implementing a distributed, in-memory key-value database with optional durability.

Most of the time I use Redis…


Photo by Jeremy Bishop on Unsplash

Assalamualaikum / Hi,

In previous story, we have done a simple setup to determined either the request is Dingo/API or normal Laravel Request.

This time, we want to setup our API routes using the isDingoApiRequest() helper.

Open up your routes/api.php and add the following codes:

if (isDingoApiRequest() || app()->runningUnitTests() || app()->runningInConsole()) {
collect(glob(base_path('/routes/api/v1/*.php')))
->each(function ($path) {
ApiRoute::version('v1', [
'middleware' => 'api.throttle',
'limit' => config('api.rate_limit', 60),
'expires' => config('api.expires', 5),
'namespace' => '\App\Http\Controllers\API',
], function () use ($path) {
require $path;
});
});
}

The above setup basically will

  1. Load the API routes when it’s Dingo/API request, or running unit testing…


Photo by JJ Ying on Unsplash

Assalamualaikum / Hi,

In previous story, I did make a workaround to fix Dingo/API and Nova API by using different Service Provider (which extend the Dingo/API Laravel Service Provider), custom exception handler

This time, another approach which I did to tackle issues raised when trying to set API_STRICT=true. If based on previous setup, I won’t be able to enable the API_STRICT=true — it will simply make my landing page return JSON response instead of making my PHPUnit not working.

So, here the details how I fix it.

Creating Custom Helper

Create custom helper which called isDingoApiRequest() — which determine if…


Photo by Krissana Porto on Unsplash

Assalamualaikum / Hi,

Laravel Telescope is a new official package from Laravel.

Laravel Telescope is an elegant debug assistant for the Laravel framework. Telescope provides insight into the requests coming into your application, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps and more. Telescope makes a wonderful companion to your local Laravel development environment.

To be able to see all requests, queues, etc in Telescope it makes your life much easier to understand how requests has been made to your application.

But if you use the same database for storing all the information…


Photo by Lee Campbell on Unsplash

Assalamualaikum / Hi,

If you are using Dingo/API (in my case I use laravie/api — a fork of Dingo/API) with with Laravel Nova, you might encounter issues conflict between Dingo/API and Laravel Nova.

Issues like:

  1. When you click on logout in Nova, you will get JSON response instead of seeing Laravel Nova login page.
  2. When you entered invalid credentials, you will get JSON response instead of seeing proper error message displayed in login form.

This is due to Dingo/API router merged with default Laravel router, hence all request are performed on Dingo/API router instead of default Laravel router.

To prevent…


Display Accessor Field In Laravel Nova

Assalamualaikum / Hi,

In Nova, I want to display relationships fields in index and details page only via the accessor.

For instance, If you have installed https://github.com/vyuldashev/nova-permission — you might want to display all roles attached to the user in the user resource.

Simplest setup is to create custom accessor for the model, and in the User Nova resource to call the custom accessor — but only display in index and details.

The Model Accessor

In the App\User model, I have added getRoleNamesAttribute() accessor.

The User Nova Resource

Once you have setup the custom accessor, you may add the…


Assalamualaikum / Hi,

It is quite exciting to get working on a project that has a Laravel Nova installed in it.

As for now, it is sort of limited resources on learning customisation in Laravel Nova.

Here is one thing I need to customise — the menu labelling under Resources menu and also the Create {RESOURCE} label.

With a little bit of digging into Laravel Nova code, I found two static methods which related to what I need and following is an enhancement of the singularLabel() and label() method.

With this trait available — you can use it in…


Assalamualaikum / Hi,

This time I will show you how to install latest MySQL 8 in your MacOS.

Backup & Clean Up

Backup your database first, then run the following command to uninstall MySQL.

$ brew uninstall mysql --force

Clean up data directory — since you already have backup previously.

$ rm -fr /usr/local/var/mysql/

Then you also need to remove / backup your my.cnf, since there’s few thing that the configuration is not used anymore, I received the following error.


Assalamualaikum / Hi,

I’ve been software developer about 10 years, and there’s always challenges in web application development.

One of the challenges is to deal with front-end development — yeah, I’m really not good at it, in terms of being creative.

But as I’m working with projects using Laravel, Blade Template comes really in handy, it’s really help you to be less worry about your front end.

Blade Template is templating engine just like Twig, Smarty, etc. — http://acmeextension.com/best-templating-engine/

To keep long story short, usually we have something like this writing our blade files:

Probably you have form like…


“gray steel gate closed with padlock” by Masaaki Komori on Unsplash

Assalamualaikum / Hi,

Yesterday did a coaching on Laravel to my client, and they come up with the request to have different login page, using different table and custom fields for id and password — instead of using default Laravel users table, email and password field name.

So they manage to have not using default users table, but a they are not quite there to get all as per requested.

So here is all the details, how to get all as per requested.

Divided to 2 parts:

  1. Part 1 — Data Preparation
  2. Part 2 — Controller and View

Part 1

Part 1…

Nasrul Hazim Bin Mohamad

Software Engineer, Laravel Trainer, IT Consultant and Blogger

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