Posts

Laravel - how to deploy code changes on hosted server

Published At: Updated At: 2025-07-24

It is recommended to do an initial installation on hosted server without all dev packages and tools. The best approach is to prepare a local docker installation where it is possible to run composer and NPM. For this purpose, we can use an intermediate server for clean code generation in PHP and css/js. The server is also used for final testing of the application before a transfer of cleaned code to the live server.

In order to have the closest possible conditions for running the...

Read More

Laravel Best Practices

Published At: Updated At: 2025-07-24

Note created on: 2023-05-05 07:45

Single responsibility principle

A class and a method should have only one responsibility.

Bad:

public function getFullNameAttribute(): string
{
    if (auth()->user() && auth()->user()->hasRole('client') && auth()->user()->isVerified()) {
        return 'Mr. ' . $this->first_name . ' ' . $this->middle_name . ' ' . $this->last_name;
    } else {
        return $this->first_name[0] . '. '...

Read More