Skip to main content

Posts

Showing posts from 2020

Laravel artisan tinker from Amazon Linux 2 (Elastic Beanstalk)

I used to execute  tinker  on previous Amazon AMI by using this command : sudo - E - u webapp php artisan tinker Now I am using  PHP 7.4 on Amazon Linux 2  and when I execute the above command, I get this error : Unable to create PsySH runtime directory . Make sure PHP is able to write to / run / user / 1000 in order to continue . So, In order to test, I gave the full permission to this folder and then executed my command again : sudo chmod 777 / run / user / 1000 sudo - E - u webapp php artisan tinker Actually, no error, but the environnement variables such as  RDS_PASSWORD  or  RDS_DB_NAME  are not loaded, making it impossible to perform database actions : Psy Shell v0 . 10.4 ( PHP 7.4 . 4 — cli ) by Justin Hileman >>> env ( 'RDS_DB_NAME' ) => null >>> User :: first () Illuminate / Database / QueryException with message 'SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `...

MySQL (Laravel Eloquent) - Get record when two columns have two or more values at the same time

I have this database that I got from  this post  that manages products and its variants: +---------------+ +---------------+ | PRODUCTS |-----< PRODUCT_SKUS | +---------------+ +---------------+ | #product_id | | #product_id | | product_name | | #sku_id | +---------------+ | sku | | | price | | +---------------+ | | +-------^-------+ +------^------+ | OPTIONS |------< SKU_VALUES | +---------------+ +-------------+ | #product_id | | #product_id | | #option_id | | #sku_id | | option_name | | #option_id | +---------------+ | value_id | | +------ v ------+ +-------^-------+ | | OPTION_VALUES |-------------+ +---------------+ | #product_id | | #option_id | | #value_id | | value_name | +---------------+ ...