Laravel 5.1 for Beginners

Learn the basics to start coding in the hottest most popular PHP framework in the industry.
4.8 (9 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
213 students enrolled
$15
$40
62% off
Take This Course
  • Lectures 24
  • Length 2.5 hours
  • Skill Level Beginner Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works

Discover

Find online courses made by experts from around the world.

Learn

Take your courses with you and learn anywhere, anytime.

Master

Learn and practice real-world skills and achieve your goals.

About This Course

Published 10/2015 English

Course Description

This course will be a project based course that will have a final product, a website, while each lecture touches on a new feature of the Laravel technology. We will build a basic blog website where you will learn how routing works, how database is integrated, forms, authentication, security and much more. All you need is a computer with an internet connection, at least to download the proper files at the beginning. You will get the most out of the course by reading the Laravel documentation, which goes into more details then I can go through in a video lecture due to time constraint. But I will cover the most important things. You will also benefit by taking the information I teach and try to apply it to your own custom website. Start small and if structured correctly, you will be able to keep adding more to your application easily. This is called scalability.

What are the requirements?

  • Basic PHP syntax
  • Basic Object Oriented Programming concepts knowledge
  • How the internet works as far as requests and responses

What am I going to get from this course?

  • Set up an Environment appropriate for Laravel production
  • Understand basic workflow
  • Understand the file structure
  • Understand the syntax
  • Have skills needed to keep improving their skillset

Who is the target audience?

  • Students with a basic understanding of webdevelopment and PHP who want to learn the hottest PHP framework right now

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.

Curriculum

Section 1: Setting up the proper Environment for Laravel to run on
07:47

In order to download specific PHP packages that we will need, especially Laravel, we will need to download a Dependency Manager called Composer. You can find this at getcomposer.org

12:31

We will go through a somewhat long process of setting of Laravel Homestead, a vagrant virtual box specifically built for Laravel projects, and this is very important as a platform for you to develop Laravel applications. Once you set this up you wont have to do it again.

Section 2: Lets get started!
09:00

When downloading Laravel, the file structure is very overwhelming and hard to know what is going on. This video will try to warm you up to the important folders and files to pay attention to (as a beginner).

Using the PHP Artisan CLI (Command Line Interface)
05:03
05:54

We will take a look at one of the core files of our application which is routes.php and this defines what will happen anytime a user visits any page on your site.

04:30

We will go over a handful of different ways to pass variables through the controller to our view. Our view will be able to use that variable and display it.

11:03

Laravel has a special, easy to use, syntax that you can use in your views whenever you need to use a variable or process some logic with a foreach loop, if statement, etc. It isn't mandatory but I would highly recommend you dont skip over this. It makes your coding much easier plus EVERY book, video, or example code online uses it so I suggest you get used to it. You won't want to go back to regular php syntax afterwards.

Section 3: Laravels Database - Eloquent ORM
03:30

We will need to set up our database configurations and laravel makes that extremely easy for us. In the background, Laravel uses a PDO connection to which ever database driver we want to use and out of the box it comes with drivers for sqlite, MySQL, Postgres, and SQL Server.

07:57

Laravel gives us a clean way to make tables in our database with migration files where we can easily design each table. It also gives us an easy way to quickly delete a table and set it back up with the right fields.

04:39

We will make a migration for our blogs table and give it all of the attributes it will initially need.

06:19

On our terminal, we will use php artisan tinker to create the data for a blog entry and persist it to our database.

07:21

Eloquent ORM (Object Relational Mapping) is an amazing abstraction for writing sql statements. Since its an ORM, the table represents a model in your project.

Create a view for our blogs
05:26
10:29

Laravel has a feature called Elixir which is a wrapper class around Gulp. It makes Gulp very very easy to use and it helps developers make the front end development processes much faster with this amazing automation tool.

04:07

We can give our routes whats called a 'named route' by using the 'as' syntax and this will make it much easier to create href links to that specific route by calling the route by the name you give it. For example

'as' => 'example.route'

04:38

We will generate a RESTful controller by defining a route in our routes.php file by saying route::resource(....). This will clean up our routes.php file

05:49

We will bring in the a cool feature for building Forms called HtmlServiceProvider.

07:56

Now we will use this FormBuilder to use some new syntax to write up our form for our blog.

06:31

We will write a custom FormRequest class that will validate our input data before it is allowed to be stored in the database. This gives our application an extra layer of protection.

12:20

/**********************************************************************

login.blade.php file snippet

**********************************************************************/

<div class="container-fluid container-top-extra">

<div class="row">

<div class="col-md-8 col-md-offset-2">

<div class="panel panel-default">

<div class="panel-heading">Login</div>

<div class="panel-body">

@if (count($errors) > 0)

<div class="alert alert-danger">

<strong>Whoops!</strong> There were some problems with your input.<br><br>

<ul>

@foreach ($errors->all() as $error)

<li>{‌{ $error }}</li>

@endforeach

</ul>

</div>

@endif

<form class="form-horizontal" role="form" method="POST" action="{‌{ url('/auth/login') }}">

<input type="hidden" name="_token" value="{‌{ csrf_token() }}">

<div class="form-group">

<label class="col-md-4 control-label">E-Mail Address</label>

<div class="col-md-6">

<input type="email" class="form-control" name="email" value="{‌{ old('email') }}">

</div>

</div>

<div class="form-group">

<label class="col-md-4 control-label">Password</label>

<div class="col-md-6">

<input type="password" class="form-control" name="password">

</div>

</div>

<div class="form-group">

<div class="col-md-6 col-md-offset-4">

<div class="checkbox">

<label>

<input type="checkbox" name="remember"> Remember Me

</label>

</div>

</div>

</div>

<div class="form-group">

<div class="col-md-6 col-md-offset-4">

<button type="submit" class="btn btn-primary">Login</button>

<a class="btn btn-link" href="{‌{ url('/password/email') }}">Forgot Your Password?</a>

</div>

</div>

</form>

</div>

</div>

</div>

</div>

</div>

@endsection


/**********************************************************************

password.blade.php file snippet

**********************************************************************/

<div class="container-fluid container-top-extra">

<div class="row">

<div class="col-md-8 col-md-offset-2">

<div class="panel panel-default">

<div class="panel-heading">Reset Password</div>

<div class="panel-body">

@if (session('status'))

<div class="alert alert-success">

{‌{ session('status') }}

</div>

@endif

@if (count($errors) > 0)

<div class="alert alert-danger">

<strong>Whoops!</strong> There were some problems with your input.<br><br>

<ul>

@foreach ($errors->all() as $error)

<li>{‌{ $error }}</li>

@endforeach

</ul>

</div>

@endif

<form class="form-horizontal" role="form" method="POST" action="{‌{ url('/password/email') }}">

<input type="hidden" name="_token" value="{‌{ csrf_token() }}">

<div class="form-group">

<label class="col-md-4 control-label">E-Mail Address</label>

<div class="col-md-6">

<input type="email" class="form-control" name="email" value="{‌{ old('email') }}">

</div>

</div>

<div class="form-group">

<div class="col-md-6 col-md-offset-4">

<button type="submit" class="btn btn-primary">

Send Password Reset Link

</button>

</div>

</div>

</form>

</div>

</div>

</div>

</div>

</div>


/**********************************************************************

register.blade.php file snippet

**********************************************************************/

<div class="container-fluid container-top-extra">

<div class="row">

<div class="col-md-8 col-md-offset-2">

<div class="panel panel-default">

<div class="panel-heading">Register</div>

<div class="panel-body">

@if (count($errors) > 0)

<div class="alert alert-danger">

<strong>Whoops!</strong> There were some problems with your input.<br><br>

<ul>

@foreach ($errors->all() as $error)

<li>{‌{ $error }}</li>

@endforeach

</ul>

</div>

@endif

<form class="form-horizontal" role="form" method="POST" action="{‌{ url('/auth/register') }}">

<input type="hidden" name="_token" value="{‌{ csrf_token() }}">

<div class="form-group">

<label class="col-md-4 control-label">Name</label>

<div class="col-md-6">

<input type="text" class="form-control" name="name" value="{‌{ old('name') }}">

</div>

</div>

<div class="form-group">

<label class="col-md-4 control-label">E-Mail Address</label>

<div class="col-md-6">

<input type="email" class="form-control" name="email" value="{‌{ old('email') }}">

</div>

</div>

<div class="form-group">

<label class="col-md-4 control-label">Password</label>

<div class="col-md-6">

<input type="password" class="form-control" name="password">

</div>

</div>

<div class="form-group">

<label class="col-md-4 control-label">Confirm Password</label>

<div class="col-md-6">

<input type="password" class="form-control" name="password_confirmation">

</div>

</div>

<div class="form-group">

<div class="col-md-6 col-md-offset-4">

<button type="submit" class="btn btn-primary">

Register

</button>

</div>

</div>

</form>

</div>

</div>

</div>

</div>

</div>


/**********************************************************************

reset.blade.php file snippet

**********************************************************************/

<div class="container-fluid containter-top-extra">

<div class="row">

<div class="col-md-8 col-md-offset-2">

<div class="panel panel-default">

<div class="panel-heading">Reset Password</div>

<div class="panel-body">

@if (count($errors) > 0)

<div class="alert alert-danger">

<strong>Whoops!</strong> There were some problems with your input.<br><br>

<ul>

@foreach ($errors->all() as $error)

<li>{‌{ $error }}</li>

@endforeach

</ul>

</div>

@endif

<form class="form-horizontal" role="form" method="POST" action="{‌{ url('/password/reset') }}">

<input type="hidden" name="_token" value="{‌{ csrf_token() }}">

<input type="hidden" name="token" value="{‌{ $token }}">

<div class="form-group">

<label class="col-md-4 control-label">E-Mail Address</label>

<div class="col-md-6">

<input type="email" class="form-control" name="email" value="{‌{ old('email') }}">

</div>

</div>

<div class="form-group">

<label class="col-md-4 control-label">Password</label>

<div class="col-md-6">

<input type="password" class="form-control" name="password">

</div>

</div>

<div class="form-group">

<label class="col-md-4 control-label">Confirm Password</label>

<div class="col-md-6">

<input type="password" class="form-control" name="password_confirmation">

</div>

</div>

<div class="form-group">

<div class="col-md-6 col-md-offset-4">

<button type="submit" class="btn btn-primary">

Reset Password

</button>

</div>

</div>

</form>

</div>

</div>

</div>

</div>

</div>

Middleware
03:14
08:44

We will use the edit and update method on our Resource Controller to, obviously, edit and update a page. We will also use Form Model Binding to be able to edit or update a particular page, or in our case a blog.

04:37

We will make our views much more readable by taking out the error snippet and our form code and place them in a partials folder. We will then include them into our view which reduces our main view we are using to just one line making it much more readable. We will also learn how to dynamically change something in a partial that may change based on which view it is included in.

04:09

We will finish off our last RESTful (Resource) Controller method. The destroy method is used to delete an item from the database, and in our case a blog entry.

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Michel McAlexander, McProgramming

Senior Computer Science major at VCU. I learned Java and other computer concepts/languages as well as math in an addictive manner. I have created many programs and help fellow students constantly. I have a great understanding of Java programming and if I dont know the answer/solution off the top of my head, I know how to find it and grasp it.

Ready to start learning?
Take This Course