Skip to content

Instantly share code, notes, and snippets.

View prodeveloper's full-sized avatar

Jacob Chencha prodeveloper

View GitHub Profile
@prodeveloper
prodeveloper / new_students.php
Created September 18, 2016 06:36
Creating new student records using faker
$student = new App\Student();$student->name = $faker->name ; $student->email = $faker->email ; $student->course=$faker->word; $student->save();
@prodeveloper
prodeveloper / introducing_laravel_controllers.md
Created September 11, 2016 09:27
Introduction to using implicit controllers in laravel

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

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;
});
@prodeveloper
prodeveloper / introduction_bootstrap.md
Last active July 12, 2016 08:37
An introduction to using bootstrap within the students project

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

@prodeveloper
prodeveloper / using_forms.md
Created June 20, 2016 08:02
Shows how to use form to populate student data instead of adding it directly via tinker

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

@prodeveloper
prodeveloper / using_data_frontend.md
Created June 13, 2016 17:43
How to use the student data in the frontend

##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:

php artisan make:migration create_students_table --create=students

Navigate to the database/migrations folder and select your file

Add the following lines to the code

            $table->string('name');
@prodeveloper
prodeveloper / dependency.php
Created April 18, 2016 17:36
Circular dependancy
<?php
@prodeveloper
prodeveloper / tbl_day.php
Created March 8, 2016 15:52
Days and months example
<table border="1">
<!--Table headers -->
<tr>
<td>Months</td>
<td>Days</td>
<td>Last day</td>
</tr>
<?php
@prodeveloper
prodeveloper / sample_registration.py
Created February 22, 2016 08:19
Organizing python code
#!/usr/bin/env python
# encoding: utf-8
# Code in your services folder
class StoreInDb():
def run(data):
StoreInDb.storeLogic(data)
data['db_status'] = "User stored in database"