Getting started with Laravel: My SCA Mentorship Journey.

Resa Obamwonyi
2 min readMar 26, 2020

Before becoming a participant in the She Code Africa mentorship program, I had heard about and read articles and documentations on Laravel.

Never built a project on it, but as a PHP developer, I wanted to learn, grow and be good at it.

Laravel is a PHP-based framework that uses the three fundamentals called Model, View, and Controller, popularly known as MVC.

To use Laravel, you need to have PHP installed, have the Composer dependency installed, and set up your favorite text editor.

(Hack: for Windows users, installing "Laragon" helps you skip this phase).

Using your Control terminal in your desired directory,(If you're using Laragon, this is found in your www folder) A new Laravel project can be created with the simple command,

"laravel new projectName"

This rolls out a default Laravel project with all the necessary packages and CSS and JavaScript set up.

The Next major magical command you might always find useful when working with Laravel is:

"php artisan make:auth"(for versions lesser than 6)

OR

"composer require laravel/ui"

"php artisan ui: auth"

This sets up the already existing Laravel Authentication system shipped with the framework (registration and login).

Running the command, "php artisan serve" will automatically launch your project.

Here are some major set up commands needed for a flawless Laravel application

php artisan make: model "ModelName" aids the set up of a Model for interacting with each table in the database.

php artisan make:migration, this creates a migration table. Migrations are like version control for your database. (The .env file is where you set up connection with your database)

php artisan migrate : This moves all your new migrations to your database.

php artisan migrate:rollback :This is used to undo your previous migration.

php artisan make:controller "ControllerName" is to set up a Controller for your View.

All views(pages in your app) are set up in tiny boxes called Routes. These routes are set up in a file called web.php.

A typical route that leads to a function for adding new posts to a certain blog page should read thus:

Route::post('/blog', 'PostController@addPost');

This means, in your PostController found under App/Http/Controllers folder, there is a function with the name 'addPost' that would control everything about adding a new post to the page called 'blog'.

All pages in a Laravel project are saved using the .blade.php extensions.

So, a contact page file will be saved this: contact.blade.php

Another magical part of the Laravel Framework is the beautiful UI for debugging during errors and mistakes.

Simply put, Laravel is PHP with a beautiful UI and shorter, cleaner and more efficient commands.

I am super grateful for the opportunity to be mentored in this framework.

This is my SCA journey and it's only forward and upwards from here.

More documentation on laravel can be found on :

https://laravel.com/docs/6.x

https://laravel.com

--

--

Resa Obamwonyi

For me, Writing is therapeutic, alongside listening to Rap, Highlife and Classical Music. I bite my nails when bored.