Posts

Showing posts from January, 2022

Easy Config / Settings save and read class with caching PHP/Laravel

Image
    Photo by Emile Perron on Unsplash     Commonly most web applications require save configs and settings . there are many ways and methods to save and retrieve configs and settings. today i will share with you my method to save and retrieve settings data in laravel application.   Create migration and and Model php artisan make:model Settings -m in your migration file: add these fields: public function up () { Schema :: create ( 'settings' , function ( Blueprint $table ) { $table -> id (); $table -> string ( 'key' ); $table -> string ( 'value' ); $table -> unsignedBigInteger ( 'updated_user' )-> nullable (); $table -> timestamps (); }); } use 'updated_user' to track who changed value last time. you can also use 'text' or any suitable type to 'value' field I used string(varchar255) here. DB Model class <?php namespace A

Popular posts from this blog

Handling undefined variables in laravel

How to use Spatie packages to enhance your Laravel development experience

Some Briefs of Data Mining