Relocating Laravel

Hi,

I'll use one example to show all the steps I had to take to move Laravel 6 from one location to another. At the very end, I'll try to see where it took too long and which steps can be shortened.

My friend Owais has generated Admin Panel and I've created Laravel project. I'll try now to install his Admin Panel on my Laragon with local MySQL and later move it to Cpanel reseller account. At the very end, I'll move content from my app to his. My Laravel app was originally made for Broxburn Bottlers and it's not in use at the moment, but it's fully functional. You can add new posts, view them, edit them, delete them. You can even make comments and see who've commented on it and when.

Second controller I've made is for remnants. But, because this word is not too popular, let's call it returns. So, you can add new returns, locate them in the warehouse, manage quantity, have striped table while looking at them to focus better on one line. I've added Ajax-based autocomplete search.

With user permissions and notifications, this is a great app for many businesses and a start for something great :). So, let's start.

So, first I've downloaded files from Owais and unzip them to my localhost at my PC:


As you can see I've added one extra folder called Right folder displaying, just to be sure I'm at the right location :).

Next step is to check if we can display index file, or receive 404 error :) instead. When you'll click on public folder, you should have an error message, not always the same. If so, you're in the right folder. Here is how my one looks like:



You can see now that it even doesn't ask for the database, but instead showing Route error. So, we should now focus on fixing it. Right? :)

If you'll go to let say bootstrap folder and delete the content of cache folder/rename it and create new cache folder empty, you'll know that error 404 pops out and there's no error anymore :). So, this is our focus for now :).

If you haven't open your favourite IDE, you can do it now and you can open the folder with this project which you work on. I use Visual Studio Code for this project. And making sure that my additional folder "Right folder displaying" is there.


It's time to open our terminal at the location of our project which we work on. In this folder, if we have composer installed on our machine globally, we can use the command: composer install. If you don't have, now is time to install Composer.

After this command, we should do: php artisan key:generate
Next is: php artisan cache:clear

Now we can check what next error will be seen in web browser. In my one, you can see this:


Have stuck here for a longer, but during clearing cache, I found that my routes didn't change to my PC ones. They are still pointing to the previous location which is C:\xampp\htdocs\Admin


Hence for that, I have to have this error. Documentation is poor on this one and I need to check where else it might be pointing. Or, I can just install Xampp on my C drive and copy whole content therewith commands after the composer install and key generator. This might be a solution as well.

And, I was right, after installation of Xampp you can see no errors apart from database connection:


Now, database connected and everything imported from the old database, but we've got an error to resolve 404:



php artisan serve and user proper routes, everything should be fine.

No comments:

Post a Comment