Fix / SET autoincrement in postgresql

Updated: 4th November 2024
Tags: sql postgresql

[postgresql only] Fix users table’ autoincrement

select setval('users_id_seq', coalesce(
(select max(id)+1 from users), 1), false)

[postgresql only] Manually set next autoincrement id of users table to 100:

setval('users_id_seq', 100)

Why I don't like soft delete

Updated: 15th September 2024
Tags: laravel programming database opinion

How to add padding to your svg

Updated: 11th September 2024
Tags: svg html

Move your app from one server to other without downtime (for reading)

Updated: 8th September 2024
Tags: ubuntu laravel

How to add imagick to Docker alpine:latest without pecl

Updated: 19th July 2024
Tags: php docker

laravel eloquent create vs insert

Updated: 17th July 2024
Tags: laravel

There are few important differences:

#InsertCreate
Respects fillable / guardedNoYes
Creates timestampsNoYes
Returns created objectNoYes
Runs booted methodNoYes
Allows multi insertYesNo

PHP helper function for path

Updated: 17th July 2024
Tags: php

How to restart supervisor laravel

Updated: 5th July 2024
Tags: laravel ubuntu supervisor

If you changed superviser config, or add new program to it, you need to restart it.

sudo supervisorctl stop all
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start "laravel-worker:*"

[Solved] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry for key 'failed_jobs_uuid_unique'

Updated: 13th June 2024
Tags: php laravel

How to check my laravel version

Updated: 14th April 2024
Tags: laravel
php artisan about

It will show laravel version with bunch of other usefull information.

artisan about

[Solved] CSRF Token Mismatch Error from API Laravel Sanctum

Updated: 14th April 2024
Tags: php laravel sanctum

[Solved] Composer require / Generating optimized autoload files is very slow

Updated: 14th April 2024
Tags: php composer laravel windows10

Add whole directory of your app to windows defender Exclusions. You can also move your projects in project directory and add projects to exclusion.

Cloudflare setup 301 Redirect from domain / subdomain

Updated: 14th April 2024
Tags: cloudflare

Social metatags for vue app

Updated: 7th April 2024
Tags: vue nginx laravel

Laravel FormRequest handling checkbox

Updated: 7th March 2024
Tags: laravel

PHP and money calculations

Updated: 10th January 2024
Tags: php

Please, use integer as cents, don’t do my mistake, if you are using PHP.

I was shocked when discovered that php is using float and doesn’t have decimal. I have a lot of code already done, so I used bcmath to get around, but if I had known this earlier, I would have used integers.

MySQL remove duplicate rows

Updated: 17th November 2023
Tags: mysql sql

How to make your editor add empty line at the end of file

Updated: 11th November 2023
Tags: editors phpstorm

How to rebase branch

Updated: 11th November 2023
Tags: git

[Solved] java.lang.IllegalStateException: Fragment not attached to a context

Updated: 11th October 2023
Tags: android java