Giter Club home page Giter Club logo

laracasts's Introduction

laracasts

Repository for the laracasts lessons

  1. Laravel From Scratch

Laravel From Scratch

Installing Laravel, teaching the basics of MVC architecture, scaffolding, databases, and configurations. Good place to start, but it doesn't go much beyond the Laravel documentation.

  1. Databases
  2. Eloquent Basics
  3. Blade Basics

Databases

Creating the database and connecting it to the Laravel Application.

Files changed:
app/config/database.php
app/routes.php

Code Added:


    //get all users from the table
    Route::get('/', function() {
      $users = DB::table('users')->get();
dd($users);
});

// get the first user of a table
Route::get('/', function() {
  $user = DB::table('users')->find(1);
  
  dd($user); 
});
  </code></pre>

Eloquent Basics

Explanation of Laravel's ORM, called eloquent. Makes writing database queries a cinch.

Files changed:
app/routes.php

Code Added:


    // // Laravel ORM
    // Route::get('/', function() {
    //   // below statement is the same as $users = DB::table('users')->where('username', '!=', 'max')->get();
    //   $users = User::where('username', '!=', 'max')->get();
//   return $users;
// });

// // grab all users
// Route::get('/', function() {
//   $users = User::all();
  
//   return $users;
// });

// // create a user
// Route::get('/', function() {
  
//   // // long way of doing it 
//   // $user = new User;
//   // $user->username = 'NewUser';
//   // $user->password = Hash::make('password');
//   // $user->save();
  
//   // Short way of doing it by creating an object
//   User::create([
//       'username' => 'AnotherUser',
//       'password' => Hash::make('anotherpassword')
//   ]);
  
//   return User::all();
// });


// Update a user
Route::get('/', function() {
  $user = User::find(2);
  
  
  $user->username = 'UpdatedName';
  $user->save();
  
  return $user;
});

Blade Basics

Laravel's templating engine. This lesson creates a simple layout for displaying users.

Files changed:

Code Added:

laracasts's People

Contributors

mhartz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.