LARAVEL

How to build a Project Management App in Laravel 5 – Part 1


In this tutorial, we are going to learn how to build a simple and very useful Project Management app in Laravel 5.

I like to develop following best practices and using the latest and best tools for development.

1. Fresh Installation of Laravel

The nature of my job makes me switch between several languages often, So I have different directories for different stacks. I have a workspace just for Laravel projects. I named the directory lara-workspace. I encourage you to have something similar.

We’ll give the name of our app Prego. Honestly, I still don’t know how I derived that name, So please don’t feel offended if it means something nasty in any language.

Let’s do a fresh installation of Laravel like so:

Or if you have Laravel installer like me, you can do something like:

Cd into the directory Prego like so:

I like to use version control for all my projects. So let’s initialize git like so:

I have created a project on Github, So I’ll just add the URL like so:

I use Sublime for virtually all my projects because it’s fast and has a plethora of cool packages for development. So I’ll open the Prego directory in Sublime.

Delete the .env.example file that ships with Laravel.

Now add everything to git

Note: We’re going to be doing this a lot. So I recommend you have aliases for them. The aliases I use are ga, gc and gpom

2. Let’s Set Up Homestead

Make sure you have Vagrant and VirtualBox or Vmware Installed.

Laravel Homestead is an official prepackaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!

The Laravel Documentation and Eric Barnes Post shows you how to set it up.

Let’s Open our Homestead.yaml file. Add the mapping to the sites section like so:

Then add the mapping to the database section like so:

Now, it’s time to edit our hosts file and add a URL for development

Go to /etc and open the hosts file, Add:

Now that we have that configured, let’s go ahead and run:

If you go to your browser and enter prego.dev:8000 , you’ll be greeted with the default laravel 5 page.

3. Change Default Namespace

Go through several files in the app/Http/Controller folder and the other folders in the app directory. An example is the Controller.php file in app/Http/Controller folder like so:

You’ll discover the namespace starts with App. Let’s change that to our own custom namespace

Run the command from the terminal like so:

Now if you check the Controller file and several other files, you’ll discover that the namespace now starts with Prego

4. Tidy Up Laravel Files

For the sake of this tutorial, I am going to delete some default files that comes with Laravel and implement some functionalities on our own. I don’t want everything that’s happening looking like Magic!

a) Delete the Auth Folder

b) Delete the two migration files that come shipped with Laravel i.e the create_users_table and create_password_resets_table  from the database/migrations folder

c) Delete the sass folder in resources/assets directory

d) Delete the gulpfile.js file in the root directory. We won’t be using Laravel Elixir

e) Delete the welcome.blade.php file in resources/views directory. That’s actually what serves the default Laravel 5 page.

Refresh your browser, you’ll discover there is an error on the page  and that’s because we deleted the view that presents that.

Don’t Panic, Just Stay Calm and join me in the next post.

If you have any questions or observations, please drop your thoughts in the comment section below

 

PROSPER OTEMUYIWA

About PROSPER OTEMUYIWA

Food Ninja, Code Slinger, Technical Trainer, Accidental Writer, Open Source Advocate and Developer Evangelist.