How to listen mysql changes in Laravel 9? - laravel-9

How can I listen Mysql database changes dynamically and see datas in frontpage with Laravel 9?
Laravel Echo can solve that problem or what else?

Related

How do I update the DB structure via cPanel without losing existing data?

I have initially implemented a Laravel project on the cPanel and imported the database. I have updated the local/development database via Laravel Migrations. I want this updated database structure to be reflected on the cPanel, without losing the data already stored on the cPanel database.
How do I update the Laravel DB on the cPanel without losing the existing cPanel data?

Laravel serve getting ERR_CONNECTION_REFUSED on localhost

I'm having an issue with my local laravel server. I'm building an API, and I need to test from another device, but the only url which is working is:
localhost:8000
If I try
127.0.0.1:8000
or using my machine local IP
192.168.0.6:8000
I have a ERR_CONNECTION_REFUSED from chrome (I tried with safari too).
There is no 'blocking' extensions
I found the answer: artisan serve isolates the host, so if I want to specify it, I need to do:
php artisan serve --host=127.0.0.1
Depending on what project you may in! In our case we had a bought project!
And https is configured by default! So https://..../app.css will not be accessible!
When you visit the link again in chrome it switch to http://.../app.css and it will work!
For our bought base code an env variable was setup and i just disabled it as bellow:
You may like to disable it in development!
This link may be helpful too!
How to force Laravel Project to use HTTPS for all routes?
Otherwise you can setup https to work well! Check how to do that with apache! Or nginx !
Otherwise know that you can't do it with php artisan serve! And you'll need to disable force https!
See the option bellow! (check the first answer to see if you can still use php artisan serve! And read the second one! To get why php artisan serve doesn't support https)
Laravel php artisan serve to mimic HTTPS
I hope this may help some! That fall on the same problem! Which is a line of things to check to add to the list here!
php artisan serve :
Laravel development server started on http://localhost:8000/
so you can only access to this server by http://localhost:8000/
I had that problem because I forgot to execute npm run devto launch Vite server.
Open up the terminal window in your working directory and run
php artisan serve
You will then be able to access your laravel local development through your browser by using the URL http://localhost:8000

How to change php version in WHM

I have a shared hosting(WHM), Let I have create 3 different hostname like
1)abc.com
2)xyc.com
3)hello.com
Now all three have same version of php. I want to change the php version of abc.com and xyz.com. Is it possible to change the version because it is shared hosting.
You Can change php version for each site individually, in WHM control panel at software category select MultiPHP Manager and choose any site you like to change php version for
Note : Make sure you already have multi php version installed by easyapache V4
For more reference : https://documentation.cpanel.net/display/ALD/MultiPHP+Manager+for+WHM#PHPVersion
On a shared hosting, you could try modifying .htaccess files to specify the PHP version that you want to use. On a dedicated server, you can follow these steps:
Login and search for "multiphp". Then click "MultiPHP Manager".
From the following screen, scroll all the way down:
From the "PHP Version" column of the previous image, select the PHP version that you want to use for each domain. You do not need to click anything. Simply select the PHP version that you want and as soon as you change your selection, the system will save the changes and you will have the new PHP version up and running for your domain.

laravel 5 template changes doesn't show

I just started learning laravel 5, and have one running on an amazon web service EC2 instance. On the EC2 instance, I have Centos 7 with the lamp stack installed. I configure laravel to work with apache virtual host (I have other virtual hosted sites running which do not use laravel). My laravel website is fine, but some of the blade template doesn't show changes on the browser when i make changes to them. Only some of the templates have this problem. I tried php artisan cache:clear and php artisan route:clear but it doesn't do anything. Anyone have the same problem and have a fix? Thanks
After some more research i was able to solve the problem. I solved it by going into the storage/framework/view and delete all files in the directory except the .gitignore file

How can I copy a YII project to another server?

I have got a YII website and I would like to make a copy from it to another domain on nginx server.
I just tried to copy it, but it doesn't working. It looks like it don't use my htaccess?
I know when I make I new project I have to install it. Is there any copy-er for YII?
The probable reason it is not working is because you have to change the location of the entry script in the index.php for the correct location for the yii main folder.
Try doing this :
Try making a new Yii webapp in that location and check that it
works.
Now copy the index.php file from that folder and then put it in your
main webapp.
If the site is still giving errors then check if the database connection is consistent and check that the server has proper write access to the main webapp folder.
Hope this helped.
Regards,
Yii is just made of files and (optionally) a database. Provided you copy both to the new server it will just work. Yii also requires server write permissions on /protected/runtime and /assets.
Make sure you're copying hidden (start with .) files too. You could use git for this and clone it into the new server.
It was something with the server. We use webmin ot that server and I hade to rewrite the config of this domain manually, after that it works great.