Archive for the ‘laravel’ Category

How to team Laravel api with Next.Js within same domain name

Initial configuration: Laravel 7.x folder: /var/www/laravel Next.Js folder: /var/www/public_html Step 1. Add your api response to laravel Add to /var/www/routes/web.php Add to /var/www/app/Http/Controllers/IndexController.php Step 2. Add api/ folder to Next.Js public folder. Don’t touch existing Next.Js static html files Move /var/www/laravel/public/index.php to /var/www/public_html/api Then edit it, change the following: Move /var/www/laravel/public/.htaccess to /var/www/public_html/api, no need […]

Creating Laravel Package

If you already have Laravel move to Step 2 Step 1. Get Laravel composer create-project –prefer-dist laravel/laravel . Step 2. Create following folder structure: mkdir -p packages/aghayevi/modulename/src Step 3. Do the following cd packages/aghayev/modulename composer init   This command will guide you through creating your composer.json config.   Package name (<vendor>/<name>) [root/modulename]: aghayevi/modulename Description []: […]

Laravel install particular version

composer create-project laravel/laravel myproject 5.1

Laravel new console command

1. Create php artisan make:command MyApp –command=myapp:perform 2. Edit vi app/Console/Commands/MyApp.php …. /** * Execute the console command. * * @return mixed */ public function handle() { echo ‘My App’; } 3. Run php artisan myapp:perform

Laravel last query raw output

<?php   dd(\DB::getQueryLog());

Laravel db migration commands

php artisan migrate php artisan migrate:rollback