This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace Tournasdim\Getgravatar\Facades; | |
use Illuminate\Support\Facades\Facade; | |
class Gravatar extends Facade { | |
/** | |
* Get the registered name of the component. | |
* | |
* @return string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace Tournasdim\Getgravatar; | |
use Illuminate\Support\ServiceProvider; | |
class GravatarServiceProvider extends ServiceProvider { | |
/** | |
* Indicates if loading of the provider is deferred. | |
* | |
* @var bool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Laravel 4 Validation example | |
Route::post('register', function() { | |
$rules = array( | |
'name' => 'required|min:3|max:80|alpha_dash', | |
'email' => 'required|between:3,64|email|unique:users', | |
'password' => 'required|alpha_num|between:4,8|confirmed', | |
'password_confirmation' => 'required|alpha_num|between:4,8' | |
); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::post('login', function() { | |
// data from login form | |
// | |
$credentials = array( | |
'email' => Input::get('email'), | |
'password' => Input::get('password') | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Signature of a Validation */ | |
$validator = Validator::make($data , $rules , $customMessage) ; | |
/* Validating submitted fields */ | |
$inputs = Input::all(); | |
$rules = array( | |
'name' => 'Required|max:100', | |
'email' => 'Required|email|max:100', | |
'msg' => 'Required|max:500' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Note that all items stored in the cache are serialized, so you are free to store any type of data | |
Cache::put('key', 'value', $minutes); // Storing An Item In The Cache | |
Cache::add('key', 'value', $minutes); // Storing An Item In The Cache If It Doesn't Exist | |
if (Cache::has('key')) { // } ; // Checking For Existence In Cache | |
$value = Cache::get('key'); // Retrieving a Cached value | |
$value = Cache::get('key', 'default'); // set a default value if key doesn't exists | |
$value = Cache::get('key', function() { return 'default'; }); // set a callback if the key doesn't exists | |
Cache::forever('key', 'value'); // storing a value permanently | |
Sometimes you may wish to retrieve an item from the cache, but also store a default value if the requested item doesn't exist : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Illuminate\Session\SessionServiceProvider --> Illuminate\Session\SessionManager --> | |
-----> Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage | |
Session::put('key', 'value'); // Storing An Item In The Session | |
Session::push('user.teams', 'developers'); // Push A Value Onto An Array Session Value | |
$value = Session::get('key'); // Retrieving An Item From The Session | |
$value = Session::get('key', 'default'); // Retrieving An Item Or Returning A Default Value | |
$value = Session::get('key', function() { return 'default'; }); // Retrieving An Item Or Returning A Default Value using a callback | |
$data = Session::all(); // Retrieving All Data From The Session | |
if (Session::has('users')) { //} ; // Determining If An Item Exists In The Session |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
php artisan migrate:make create_user_table | |
// app/database/migrations folder | |
<?php | |
use Illuminate\Database\Migrations\Migration; | |
class CreateUserTable extends Migration { | |
public function up() | |
{ |