Learning to Code Again

I had the first long break of the year, that is 4 days off in a row! – but alas, I still have another PT session later afternoon if that’s gonna happen today. So I took this opportunity to catch up on other things that are not related to fitness! Ironically, I had always wanted to have my own PT apps and wanted to develop one – so it’s still fitness related only on different components of running a PT or fitness business.

I have been wanting to upgrade my coding and software development knowledge using what my younger peers would have been doing to develop apps and systems. I spent hours yesterday to understand and try out things. Turns out the fundamental server environment is still the same, looking at almost 80% of web apps and systems are still developed using PHP and MySQL combo.

Next one in line, is to learn and develop Python apps. I am documenting what I did here so that I would know what to do next time when I am developing a new Laravel apps. I tried with Docker but still could not understand how the platform works. Next time buddy!

What to prepare for a Laravel apps development:

  • PHP, MySQL, Apache server combo setup (and PhpMyAdmin) – alternatively can use XAMPP. Please refer to Laravel manual to enable the PHP extensions needed for development.
  • Composer
  • Git
  • Notepad++ (still is my preferred editor for coding until I find something better!)

Basically this is it. I could not get it done yesterday despite of many attempts, because I was trying to create one from CPanel and the usual remote development that I normally do (I find it tedious to develop on local, and later upload them online). After a lot of trials and errors, I found that this tutorial accelerated my understanding of the framework (despite of not getting it the first time around).

Important codes for development:

  1. Create Laravel project
composer create-project --prefer-dist laravel/laravel AppsName

2. Create and configure database – first, create a MySQL database for the project. And then find .env file and configure these settings:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=the_app_db_name
DB_USERNAME=db_username
DB_PASSWORD=db_password

3. And then run this code to setup and connect with the database

php artisan migrate

4. In between, various configurations of views (interface layout) and controllers/parameters setup. This one, I need to develop more apps to understand how these works. Thanks for online tutorials!

5. To run the developed apps or getting it online, use this code:

php artisan serve

This new way of coding for me really saves a lot of time coding then what I am used to doing, because we really went writing everything from scratch. Thank God there were already JS and CSS codes that were being shared that time for styling interfaces. Not sure yet of the security threats of the framework, but it felt pretty secure due to the complex framework structure. From this learning, I realised that I still really enjoyed coding (or maybe the accomplishment when finally getting an apps done) – building from idea into something usable. It’s the hours of sitting down and the roadblocks when I could not find the root cause of problems that’s putting me off. Slowly getting the hang of it!