##Step 1:
Ensure we have some records on your Student class that you can use. Ensure mysql is running.
Run mysql-ctl cli. This starts the mysql database which normally closes if your Cloud 9 account if offline for a while.
##Step 2:
##Step 1:
Ensure we have some records on your Student class that you can use. Ensure mysql is running.
Run mysql-ctl cli. This starts the mysql database which normally closes if your Cloud 9 account if offline for a while.
##Step 2:
In this exercise we are going to create a way to add students using a form.
##Step 1
Create a new file called new_student.blade.php in your views folder. That is where you will store your form.
Type in the html code on the form
Bootstrap is a easy to use frontend framework that enables you to quickly style your applications.
We will be using bootstrap in all our projects going forward.
##Step 1
Lets start by getting the CDN code from their site. http://getbootstrap.com/getting-started/.
Copy the CDN code
So far we have been able to successfully create and list all records. In this lesson we will be looking at how we can edit the records that we previously created.
##Step 1
As usual the first step is always to create and test the route.
Route::get('/students/{id}/edit',function($id){
return "Editing the student with id " . $id;
});
In the past classes we have been doing all of our routes via the route.php file.
This tactic however does not scale well when you are building a production level application.
Controllers help you organize your routes into meaningful chunks. In addition to better organization, you can now work with the routes as a collective.
To illustrate we will move student routes to a controller called StudentController
##Step 1
| $student = new App\Student();$student->name = $faker->name ; $student->email = $faker->email ; $student->course=$faker->word; $student->save(); |
Once you have your app in production. Data is guaranteed to start flowing in. As such you can no longer show all the information from a particular table at once.
Laravel provides an out of the box solution for pagination.
##Step 1:
Ensure you have enough student records so that they can be paginated. That is have at least 20 records in your students database.
You can do this by adding records using your form.
Laravel at the moment is at version 5.3. In class we have been using Laravel 5.2.
This is a major upgrade:
##Step 1
##What is an API
In previous classes, we have been using forms and tables to input and display data respectively.
This works well for pure web applications. When we want to open up our application for integration, then we need an API (Application Programming Interface).
An API allows programmatic access to your application. This means that integrations such as:
We have looked at how to create an API. In this challenge we shall be looking at how to consume one.
Based on the test data here
https://jsonplaceholder.typicode.com/posts
Create a system that displays this information in a table.
Notes: