Commit 8a9acbcc by Taylor Otwell

Merge branch 'staging'

parents 1b475d8f cfe5fa10
...@@ -24,7 +24,7 @@ return array( ...@@ -24,7 +24,7 @@ return array(
"alpha" => ":attribute darf nur Buchstaben beinhalten.", "alpha" => ":attribute darf nur Buchstaben beinhalten.",
"alpha_dash" => ":attribute sollte nur aus Buchstaben, Nummern und Bindestrichen bestehen.", "alpha_dash" => ":attribute sollte nur aus Buchstaben, Nummern und Bindestrichen bestehen.",
"alpha_num" => ":attribute sollte nur aus Buchstaben und Nummern bestehen.", "alpha_num" => ":attribute sollte nur aus Buchstaben und Nummern bestehen.",
"array" => "The :attribute must have selected elements.", "array" => ":attribute muss ausgewählte Elemente haben.",
"before" => ":attribute muss ein Datum vor dem :date sein.", "before" => ":attribute muss ein Datum vor dem :date sein.",
"between" => array( "between" => array(
"numeric" => ":attribute muss zwischen :min und :max liegen.", "numeric" => ":attribute muss zwischen :min und :max liegen.",
...@@ -32,10 +32,10 @@ return array( ...@@ -32,10 +32,10 @@ return array(
"string" => ":attribute muss zwischen :min und :max Zeichen lang sein.", "string" => ":attribute muss zwischen :min und :max Zeichen lang sein.",
), ),
"confirmed" => ":attribute stimmt nicht mit der Bestätigung überein.", "confirmed" => ":attribute stimmt nicht mit der Bestätigung überein.",
"count" => "The :attribute must have exactly :count selected elements.", "count" => ":attribute muss genau :count ausgewählte Elemente haben.",
"countbetween" => "The :attribute must have between :min and :max selected elements.", "countbetween" => ":attribute muss zwischen :min und :max ausgewählte Elemente haben.",
"countmax" => "The :attribute must have less than :max selected elements.", "countmax" => ":attribute muss weniger als :max ausgewählte Elemente haben.",
"countmin" => "The :attribute must have at least :min selected elements.", "countmin" => ":attribute muss mindestens :min ausgewählte Elemente haben.",
"different" => ":attribute und :other müssen verschieden sein.", "different" => ":attribute und :other müssen verschieden sein.",
"email" => ":attribute ist keine gültige Email-Adresse.", "email" => ":attribute ist keine gültige Email-Adresse.",
"exists" => "Der gewählte Wert für :attribute ist ungültig.", "exists" => "Der gewählte Wert für :attribute ist ungültig.",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Laravel - A PHP Framework For Web Artisans * Laravel - A PHP Framework For Web Artisans
* *
* @package Laravel * @package Laravel
* @version 3.2.6 * @version 3.2.7
* @author Taylor Otwell <taylorotwell@gmail.com> * @author Taylor Otwell <taylorotwell@gmail.com>
* @link http://laravel.com * @link http://laravel.com
*/ */
......
...@@ -7,14 +7,20 @@ class Eloquent extends Driver { ...@@ -7,14 +7,20 @@ class Eloquent extends Driver {
* *
* If the user is a guest, null should be returned. * If the user is a guest, null should be returned.
* *
* @param int $id * @param int|object $token
* @return mixed|null * @return mixed|null
*/ */
public function retrieve($id) public function retrieve($token)
{ {
if (filter_var($id, FILTER_VALIDATE_INT) !== false) // We return an object here either if the passed token is an integer (ID)
// or if we are passed a model object of the correct type
if (filter_var($token, FILTER_VALIDATE_INT) !== false)
{ {
return $this->model()->find($id); return $this->model()->find($token);
}
else if (get_class($token) == Config::get('auth.model'))
{
return $token;
} }
} }
......
...@@ -191,7 +191,7 @@ class Bundle { ...@@ -191,7 +191,7 @@ class Bundle {
foreach (static::$bundles as $key => $value) foreach (static::$bundles as $key => $value)
{ {
if (isset($value['handles']) and starts_with($uri, $value['handles'].'/')) if (isset($value['handles']) and starts_with($uri, $value['handles'].'/') or $value['handles'] == '/')
{ {
return $key; return $key;
} }
......
...@@ -14,7 +14,7 @@ class Route extends Task { ...@@ -14,7 +14,7 @@ class Route extends Task {
*/ */
public function call($arguments = array()) public function call($arguments = array())
{ {
if ( ! count($arguments) == 2) if ( count($arguments) != 2)
{ {
throw new \Exception("Please specify a request method and URI."); throw new \Exception("Please specify a request method and URI.");
} }
...@@ -41,7 +41,7 @@ class Route extends Task { ...@@ -41,7 +41,7 @@ class Route extends Task {
// We'll call the router using the method and URI specified by // We'll call the router using the method and URI specified by
// the developer on the CLI. If a route is found, we will not // the developer on the CLI. If a route is found, we will not
// run the filters, but simply dump the result. // run the filters, but simply dump the result.
$route = Router::route(Request::method(), URI::current()); $route = Router::route(Request::method(), $_SERVER['REQUEST_URI']);
if ( ! is_null($route)) if ( ! is_null($route))
{ {
...@@ -53,4 +53,4 @@ class Route extends Task { ...@@ -53,4 +53,4 @@ class Route extends Task {
} }
} }
} }
\ No newline at end of file
...@@ -28,8 +28,16 @@ class SQLServer extends Connector { ...@@ -28,8 +28,16 @@ class SQLServer extends Connector {
// also be used to connect to Azure SQL Server databases. The port is defined // also be used to connect to Azure SQL Server databases. The port is defined
// directly after the server name, so we'll create that first. // directly after the server name, so we'll create that first.
$port = (isset($port)) ? ','.$port : ''; $port = (isset($port)) ? ','.$port : '';
$dsn = "sqlsrv:Server={$host}{$port};Database={$database}"; //check for dblib for mac users connecting to mssql (utilizes freetds)
if (!empty($dsn_type) and $dsn_type == 'dblib')
{
$dsn = "dblib:host={$host}{$port};dbname={$database}";
}
else
{
$dsn = "sqlsrv:Server={$host}{$port};Database={$database}";
}
return new PDO($dsn, $username, $password, $this->options($config)); return new PDO($dsn, $username, $password, $this->options($config));
} }
......
...@@ -445,7 +445,7 @@ abstract class Model { ...@@ -445,7 +445,7 @@ abstract class Model {
* *
* @return void * @return void
*/ */
protected function timestamp() public function timestamp()
{ {
$this->updated_at = new \DateTime; $this->updated_at = new \DateTime;
...@@ -617,6 +617,8 @@ abstract class Model { ...@@ -617,6 +617,8 @@ abstract class Model {
// to_array method, keying them both by name and ID. // to_array method, keying them both by name and ID.
elseif (is_array($models)) elseif (is_array($models))
{ {
$attributes[$name] = array();
foreach ($models as $id => $model) foreach ($models as $id => $model)
{ {
$attributes[$name][$id] = $model->to_array(); $attributes[$name][$id] = $model->to_array();
......
...@@ -26,7 +26,7 @@ class Pivot extends Model { ...@@ -26,7 +26,7 @@ class Pivot extends Model {
public function __construct($table, $connection = null) public function __construct($table, $connection = null)
{ {
$this->pivot_table = $table; $this->pivot_table = $table;
$this->connection = $connection; static::$connection = $connection;
parent::__construct(array(), true); parent::__construct(array(), true);
} }
...@@ -41,14 +41,4 @@ class Pivot extends Model { ...@@ -41,14 +41,4 @@ class Pivot extends Model {
return $this->pivot_table; return $this->pivot_table;
} }
/**
* Get the connection used by the pivot table.
*
* @return string
*/
public function connection()
{
return $this->connection;
}
} }
\ No newline at end of file
...@@ -85,12 +85,14 @@ class Has_Many_And_Belongs_To extends Relationship { ...@@ -85,12 +85,14 @@ class Has_Many_And_Belongs_To extends Relationship {
/** /**
* Insert a new record into the joining table of the association. * Insert a new record into the joining table of the association.
* *
* @param int $id * @param Model|int $id
* @param array $joining * @param array $attributes
* @return bool * @return bool
*/ */
public function attach($id, $attributes = array()) public function attach($id, $attributes = array())
{ {
if ($id instanceof Model) $id = $id->get_key();
$joining = array_merge($this->join_record($id), $attributes); $joining = array_merge($this->join_record($id), $attributes);
return $this->insert_joining($joining); return $this->insert_joining($joining);
...@@ -99,12 +101,13 @@ class Has_Many_And_Belongs_To extends Relationship { ...@@ -99,12 +101,13 @@ class Has_Many_And_Belongs_To extends Relationship {
/** /**
* Detach a record from the joining table of the association. * Detach a record from the joining table of the association.
* *
* @param int $ids * @param array|Model|int $ids
* @return bool * @return bool
*/ */
public function detach($ids) public function detach($ids)
{ {
if ( ! is_array($ids)) $ids = array($ids); if ($ids instanceof Model) $ids = array($ids->get_key());
elseif ( ! is_array($ids)) $ids = array($ids);
return $this->pivot()->where_in($this->other_key(), $ids)->delete(); return $this->pivot()->where_in($this->other_key(), $ids)->delete();
} }
......
...@@ -7,16 +7,25 @@ class Has_One_Or_Many extends Relationship { ...@@ -7,16 +7,25 @@ class Has_One_Or_Many extends Relationship {
/** /**
* Insert a new record for the association. * Insert a new record for the association.
* *
* If save is successful, the model will be returned, otherwise false.
*
* @param Model|array $attributes * @param Model|array $attributes
* @return bool * @return Model|false
*/ */
public function insert($attributes) public function insert($attributes)
{ {
$attributes = ($attributes instanceof Model) ? $attributes->attributes : $attributes; if ($attributes instanceof Model)
{
$attributes[$this->foreign_key()] = $this->base->get_key(); $attributes->set_attribute($this->foreign_key(), $this->base->get_key());
return $attributes->save() ? $attributes : false;
}
else
{
$attributes[$this->foreign_key()] = $this->base->get_key();
return $this->model->create($attributes); return $this->model->create($attributes);
}
} }
/** /**
......
...@@ -621,7 +621,7 @@ class Query { ...@@ -621,7 +621,7 @@ class Query {
// set the keys on the array of values using the array_combine // set the keys on the array of values using the array_combine
// function provided by PHP, which should give us the proper // function provided by PHP, which should give us the proper
// array form to return from the method. // array form to return from the method.
if ( ! is_null($key)) if ( ! is_null($key) && count($results))
{ {
return array_combine(array_map(function($row) use ($key) return array_combine(array_map(function($row) use ($key)
{ {
......
...@@ -51,6 +51,18 @@ abstract class Grammar extends \Laravel\Database\Grammar { ...@@ -51,6 +51,18 @@ abstract class Grammar extends \Laravel\Database\Grammar {
} }
/** /**
* Generate the SQL statement for a drop table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public function drop(Table $table, Fluent $command)
{
return 'DROP TABLE '.$this->wrap($table);
}
/**
* Drop a constraint from the table. * Drop a constraint from the table.
* *
* @param Table $table * @param Table $table
......
...@@ -225,18 +225,6 @@ class MySQL extends Grammar { ...@@ -225,18 +225,6 @@ class MySQL extends Grammar {
} }
/** /**
* Generate the SQL statement for a drop table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public function drop(Table $table, Fluent $command)
{
return 'DROP TABLE '.$this->wrap($table);
}
/**
* Generate the SQL statement for a drop column command. * Generate the SQL statement for a drop column command.
* *
* @param Table $table * @param Table $table
......
...@@ -211,18 +211,6 @@ class Postgres extends Grammar { ...@@ -211,18 +211,6 @@ class Postgres extends Grammar {
} }
/** /**
* Generate the SQL statement for a drop table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public function drop(Table $table, Fluent $command)
{
return 'DROP TABLE '.$this->wrap($table);
}
/**
* Generate the SQL statement for a drop column command. * Generate the SQL statement for a drop column command.
* *
* @param Table $table * @param Table $table
......
...@@ -214,18 +214,6 @@ class SQLite extends Grammar { ...@@ -214,18 +214,6 @@ class SQLite extends Grammar {
} }
/** /**
* Generate the SQL statement for a drop table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public function drop(Table $table, Fluent $command)
{
return 'DROP TABLE '.$this->wrap($table);
}
/**
* Generate the SQL statement for a drop unique key command. * Generate the SQL statement for a drop unique key command.
* *
* @param Table $table * @param Table $table
......
...@@ -225,18 +225,6 @@ class SQLServer extends Grammar { ...@@ -225,18 +225,6 @@ class SQLServer extends Grammar {
} }
/** /**
* Generate the SQL statement for a drop table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public function drop(Table $table, Fluent $command)
{
return 'DROP TABLE '.$this->wrap($table);
}
/**
* Generate the SQL statement for a drop column command. * Generate the SQL statement for a drop column command.
* *
* @param Table $table * @param Table $table
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
## Contents ## Contents
- [Laravel 3.2.7](#3.2.7)
- [Upgrading From 3.2.6](#upgrade-3.2.7)
- [Laravel 3.2.6](#3.2.6) - [Laravel 3.2.6](#3.2.6)
- [Upgrading From 3.2.5](#upgrade-3.2.6) - [Upgrading From 3.2.5](#upgrade-3.2.6)
- [Laravel 3.2.5](#3.2.5) - [Laravel 3.2.5](#3.2.5)
...@@ -37,6 +39,17 @@ ...@@ -37,6 +39,17 @@
- [Laravel 3.1](#3.1) - [Laravel 3.1](#3.1)
- [Upgrading From 3.0](#upgrade-3.1) - [Upgrading From 3.0](#upgrade-3.1)
<a name="3.2.7"></a>
## Laravel 3.2.7
- Fix bug in Eloquent `to_array` method.
- Fix bug in displaying of generic error page.
<a name="upgrade-3.2.7"></a>
### Upgrading From 3.2.6
- Replace the **laravel** folder.
<a name="3.2.6"></a> <a name="3.2.6"></a>
## Laravel 3.2.6 ## Laravel 3.2.6
......
# Contributing to Laravel via Command-Line # Contributing to Laravel via Command-Line
## Contents ## Contents
- [Getting Started](#getting-started)
- [Forking Laravel](#forking-laravel) - [Getting Started](#getting-started)
- [Cloning Laravel](#cloning-laravel) - [Forking Laravel](#forking-laravel)
- [Adding your Fork](#adding-your-fork) - [Cloning Laravel](#cloning-laravel)
- [Creating Branches](#creating-branches) - [Adding your Fork](#adding-your-fork)
- [Committing](#committing) - [Creating Branches](#creating-branches)
- [Submitting a Pull Request](#submitting-a-pull-request) - [Committing](#committing)
- [What's Next?](#whats-next) - [Submitting a Pull Request](#submitting-a-pull-request)
- [What's Next?](#whats-next)
<a name='getting-started'></a>
<a name="getting-started"></a>
## Getting Started ## Getting Started
This tutorial explains the basics of contributing to a project on [GitHub](https://github.com/) via the command-line. The workflow can apply to most projects on GitHub, but in this case, we will be focused on the [Laravel](https://github.com/laravel/laravel) project. This tutorial is applicable to OSX, Linux and Windows. This tutorial explains the basics of contributing to a project on [GitHub](https://github.com/) via the command-line. The workflow can apply to most projects on GitHub, but in this case, we will be focused on the [Laravel](https://github.com/laravel/laravel) project. This tutorial is applicable to OSX, Linux and Windows.
This tutorial assumes you have installed [Git](http://git-scm.com/) and you have created a [GitHub account](https://github.com/signup/free). If you haven't already, look at the [Laravel on GitHub](/docs/contrib/github) documentation in order to familiarize yourself with Laravel's repositories and branches. This tutorial assumes you have installed [Git](http://git-scm.com/) and you have created a [GitHub account](https://github.com/signup/free). If you haven't already, look at the [Laravel on GitHub](/docs/contrib/github) documentation in order to familiarize yourself with Laravel's repositories and branches.
<a name='forking-laravel'></a> <a name="forking-laravel"></a>
## Forking Laravel ## Forking Laravel
Login to GitHub and visit the [Laravel Repository](https://github.com/laravel/laravel). Click on the **Fork** button. This will create your own fork of Laravel in your own GitHub account. Your Laravel fork will be located at **https://github.com/username/laravel** (your GitHub username will be used in place of *username*). Login to GitHub and visit the [Laravel Repository](https://github.com/laravel/laravel). Click on the **Fork** button. This will create your own fork of Laravel in your own GitHub account. Your Laravel fork will be located at **https://github.com/username/laravel** (your GitHub username will be used in place of *username*).
<a name='cloning-laravel'></a> <a name="cloning-laravel"></a>
## Cloning Laravel ## Cloning Laravel
Open up the command-line or terminal and make a new directory where you can make development changes to Laravel: Open up the command-line or terminal and make a new directory where you can make development changes to Laravel:
...@@ -36,7 +37,7 @@ Next, clone the Laravel repository (not your fork you made): ...@@ -36,7 +37,7 @@ Next, clone the Laravel repository (not your fork you made):
> **Note**: The reason you are cloning the original Laravel repository (and not the fork you made) is so you can always pull down the most recent changes from the Laravel repository to your local repository. > **Note**: The reason you are cloning the original Laravel repository (and not the fork you made) is so you can always pull down the most recent changes from the Laravel repository to your local repository.
<a name='adding-your-fork'></a> <a name="adding-your-fork"></a>
## Adding your Fork ## Adding your Fork
Next, it's time to add the fork you made as a **remote repository**: Next, it's time to add the fork you made as a **remote repository**:
...@@ -49,7 +50,7 @@ Remember to replace *username** with your GitHub username. *This is case-sensiti ...@@ -49,7 +50,7 @@ Remember to replace *username** with your GitHub username. *This is case-sensiti
Now you have a pristine clone of the Laravel repository along with your fork as a remote repository. You are ready to begin branching for new features or fixing bugs. Now you have a pristine clone of the Laravel repository along with your fork as a remote repository. You are ready to begin branching for new features or fixing bugs.
<a name='creating-branches'></a> <a name="creating-branches"></a>
## Creating Branches ## Creating Branches
First, make sure you are working in the **develop** branch. If you submit changes to the **master** branch, it is unlikely they will be pulled in anytime in the near future. For more information on this, read the documentation for [Laravel on GitHub](/docs/contrib/github). To switch to the develop branch: First, make sure you are working in the **develop** branch. If you submit changes to the **master** branch, it is unlikely they will be pulled in anytime in the near future. For more information on this, read the documentation for [Laravel on GitHub](/docs/contrib/github). To switch to the develop branch:
...@@ -76,7 +77,7 @@ Or if there is a new feature to add or change to the documentation that you want ...@@ -76,7 +77,7 @@ Or if there is a new feature to add or change to the documentation that you want
Now that you have created your own branch and have switched to it, it's time to make your changes to the code. Add your new feature or fix that bug. Now that you have created your own branch and have switched to it, it's time to make your changes to the code. Add your new feature or fix that bug.
<a name='committing'></a> <a name="committing"></a>
## Committing ## Committing
Now that you have finished coding and testing your changes, it's time to commit them to your local repository. First, add the files that you changed/added: Now that you have finished coding and testing your changes, it's time to commit them to your local repository. First, add the files that you changed/added:
...@@ -87,10 +88,10 @@ Next, commit the changes to the repository: ...@@ -87,10 +88,10 @@ Next, commit the changes to the repository:
# git commit -s -m "I added some more stuff to the Localization documentation." # git commit -s -m "I added some more stuff to the Localization documentation."
- **-s** means that you are signing-off on your commit with your name. This tells the Laravel team know that you personally agree to your code being added to the Laravel core. "- **-s** means that you are signing-off on your commit with your name. This tells the Laravel team know that you personally agree to your code being added to the Laravel core.
- **-m** is the message that goes with your commit. Provide a brief explanation of what you added or changed. "- **-m** is the message that goes with your commit. Provide a brief explanation of what you added or changed.
<a name='pushing-to-your-fork'></a> <a name="pushing-to-your-fork"></a>
## Pushing to your Fork ## Pushing to your Fork
Now that your local repository has your committed changes, it's time to push (or sync) your new branch to your fork that is hosted in GitHub: Now that your local repository has your committed changes, it's time to push (or sync) your new branch to your fork that is hosted in GitHub:
...@@ -99,19 +100,19 @@ Now that your local repository has your committed changes, it's time to push (or ...@@ -99,19 +100,19 @@ Now that your local repository has your committed changes, it's time to push (or
Your branch has been successfully pushed to your fork on GitHub. Your branch has been successfully pushed to your fork on GitHub.
<a name='submitting-a-pull-request'></a> <a name="submitting-a-pull-request"></a>
## Submitting a Pull Request ## Submitting a Pull Request
The final step is to submit a pull request to the Laravel repository. This means that you are requesting that the Laravel team pull and merge your changes to the Laravel core. In your browser, visit your Laravel fork at [https://github.com/username/laravel](https://github.com/username/laravel). Click on **Pull Request**. Next, make sure you choose the proper base and head repositories and branches: The final step is to submit a pull request to the Laravel repository. This means that you are requesting that the Laravel team pull and merge your changes to the Laravel core. In your browser, visit your Laravel fork at [https://github.com/username/laravel](https://github.com/username/laravel). Click on **Pull Request**. Next, make sure you choose the proper base and head repositories and branches:
- **base repo:** laravel/laravel - **base repo:** laravel/laravel
- **base branch:** develop - **base branch:** develop
- **head repo:** username/laravel - **head repo:** username/laravel
- **head branch:** feature/localization-docs - **head branch:** feature/localization-docs
Use the form to write a more detailed description of the changes you made and why you made them. Finally, click **Send pull request**. That's it! The changes you made have been submitted to the Laravel team. Use the form to write a more detailed description of the changes you made and why you made them. Finally, click **Send pull request**. That's it! The changes you made have been submitted to the Laravel team.
<a name='whats-next'></a> <a name="whats-next"></a>
## What's Next? ## What's Next?
Do you have another feature you want to add or another bug you need to fix? First, make sure you always base your new branch off of the develop branch: Do you have another feature you want to add or another bug you need to fix? First, make sure you always base your new branch off of the develop branch:
......
# Contributing to Laravel using TortoiseGit # Contributing to Laravel using TortoiseGit
## Contents ## Contents
- [Getting Started](#getting-started)
- [Forking Laravel](#forking-laravel) - [Getting Started](#getting-started)
- [Cloning Laravel](#cloning-laravel) - [Forking Laravel](#forking-laravel)
- [Adding your Fork](#adding-your-fork) - [Cloning Laravel](#cloning-laravel)
- [Creating Branches](#creating-branches) - [Adding your Fork](#adding-your-fork)
- [Committing](#committing) - [Creating Branches](#creating-branches)
- [Submitting a Pull Request](#submitting-a-pull-request) - [Committing](#committing)
- [What's Next?](#whats-next) - [Submitting a Pull Request](#submitting-a-pull-request)
- [What's Next?](#whats-next)
<a name='getting-started'></a>
<a name="getting-started"></a>
## Getting Started ## Getting Started
This tutorial explains the basics of contributing to a project on [GitHub](https://github.com/) using [TortoiseGit](http://code.google.com/p/tortoisegit/) for Windows. The workflow can apply to most projects on GitHub, but in this case, we will be focused on the [Laravel](https://github.com/laravel/laravel) project. This tutorial explains the basics of contributing to a project on [GitHub](https://github.com/) using [TortoiseGit](http://code.google.com/p/tortoisegit/) for Windows. The workflow can apply to most projects on GitHub, but in this case, we will be focused on the [Laravel](https://github.com/laravel/laravel) project.
This tutorial assumes you have installed TortoiseGit for Windows and you have created a GitHub account. If you haven't already, look at the [Laravel on GitHub](/docs/contrib/github) documentation in order to familiarize yourself with Laravel's repositories and branches. This tutorial assumes you have installed TortoiseGit for Windows and you have created a GitHub account. If you haven't already, look at the [Laravel on GitHub](/docs/contrib/github) documentation in order to familiarize yourself with Laravel's repositories and branches.
<a name='forking-laravel'></a> <a name="forking-laravel"></a>
## Forking Laravel ## Forking Laravel
Login to GitHub and visit the [Laravel Repository](https://github.com/laravel/laravel). Click on the **Fork** button. This will create your own fork of Laravel in your own GitHub account. Your Laravel fork will be located at **https://github.com/username/laravel** (your GitHub username will be used in place of *username*). Login to GitHub and visit the [Laravel Repository](https://github.com/laravel/laravel). Click on the **Fork** button. This will create your own fork of Laravel in your own GitHub account. Your Laravel fork will be located at **https://github.com/username/laravel** (your GitHub username will be used in place of *username*).
<a name='cloning-laravel'></a> <a name="cloning-laravel"></a>
## Cloning Laravel ## Cloning Laravel
Open up Windows Explorer and create a new directory where you can make development changes to Laravel. Open up Windows Explorer and create a new directory where you can make development changes to Laravel.
- Right-click the Laravel directory to bring up the context menu. Click on **Git Clone...** - Right-click the Laravel directory to bring up the context menu. Click on **Git Clone...**
- Git clone - Git clone
- **Url:** https://github.com/laravel/laravel.git - **Url:** https://github.com/laravel/laravel.git
- **Directory:** the directory that you just created in the previous step - **Directory:** the directory that you just created in the previous step
- Click **OK** - Click **OK**
> **Note**: The reason you are cloning the original Laravel repository (and not the fork you made) is so you can always pull down the most recent changes from the Laravel repository to your local repository. > **Note**: The reason you are cloning the original Laravel repository (and not the fork you made) is so you can always pull down the most recent changes from the Laravel repository to your local repository.
<a name='adding-your-fork'></a> <a name="adding-your-fork"></a>
## Adding your Fork ## Adding your Fork
After the cloning process is complete, it's time to add the fork you made as a **remote repository**. After the cloning process is complete, it's time to add the fork you made as a **remote repository**.
- Right-click the Laravel directory and goto **TortoiseGit > Settings** - Right-click the Laravel directory and goto **TortoiseGit > Settings**
- Goto the **Git/Remote** section. Add a new remote: - Goto the **Git/Remote** section. Add a new remote:
- **Remote**: fork - **Remote**: fork
- **URL**: https://github.com/username/laravel.git - **URL**: https://github.com/username/laravel.git
- Click **Add New/Save** - Click **Add New/Save**
...@@ -49,12 +50,12 @@ After the cloning process is complete, it's time to add the fork you made as a * ...@@ -49,12 +50,12 @@ After the cloning process is complete, it's time to add the fork you made as a *
Remember to replace *username* with your GitHub username. *This is case-sensitive*. Remember to replace *username* with your GitHub username. *This is case-sensitive*.
<a name='creating-branches'></a> <a name="creating-branches"></a>
## Creating Branches ## Creating Branches
Now you are ready to create a new branch for your new feature or bug-fix. When you create a new branch, use a self-descriptive naming convention. For example, if you are going to fix a bug in Eloquent, name your branch *bug/eloquent*. Or if you were going to make changes to the localization documentation, name your branch *feature/localization-docs*. A good naming convention will encourage organization and help others understand the purpose of your branch. Now you are ready to create a new branch for your new feature or bug-fix. When you create a new branch, use a self-descriptive naming convention. For example, if you are going to fix a bug in Eloquent, name your branch *bug/eloquent*. Or if you were going to make changes to the localization documentation, name your branch *feature/localization-docs*. A good naming convention will encourage organization and help others understand the purpose of your branch.
- Right-click the Laravel directory and goto **TortoiseGit > Create Branch** - Right-click the Laravel directory and goto **TortoiseGit > Create Branch**
- **Branch:** feature/localization-docs - **Branch:** feature/localization-docs
- **Base On Branch:** remotes/origin/develop - **Base On Branch:** remotes/origin/develop
- **Check** *Track* - **Check** *Track*
...@@ -67,47 +68,47 @@ This will create your new *feature/localization-docs* branch and switch you to i ...@@ -67,47 +68,47 @@ This will create your new *feature/localization-docs* branch and switch you to i
Now that you have created your own branch and have switched to it, it's time to make your changes to the code. Add your new feature or fix that bug. Now that you have created your own branch and have switched to it, it's time to make your changes to the code. Add your new feature or fix that bug.
<a name='committing'></a> <a name="committing"></a>
##Committing ##Committing
Now that you have finished coding and testing your changes, it's time to commit them to your local repository: Now that you have finished coding and testing your changes, it's time to commit them to your local repository:
- Right-click the Laravel directory and goto **Git Commit -> "feature/localization-docs"...** - Right-click the Laravel directory and goto **Git Commit -> "feature/localization-docs"...**
- Commit - Commit
- **Message:** Provide a brief explaination of what you added or changed - **Message:** Provide a brief explaination of what you added or changed
- Click **Sign** - This tells the Laravel team know that you personally agree to your code being added to the Laravel core - Click **Sign** - This tells the Laravel team know that you personally agree to your code being added to the Laravel core
- **Changes made:** Check all changed/added files - **Changes made:** Check all changed/added files
- Click **OK** - Click **OK**
<a name='pushing-to-your-fork'></a> <a name="pushing-to-your-fork"></a>
## Pushing to your Fork ## Pushing to your Fork
Now that your local repository has your committed changes, it's time to push (or sync) your new branch to your fork that is hosted in GitHub: Now that your local repository has your committed changes, it's time to push (or sync) your new branch to your fork that is hosted in GitHub:
- Right-click the Laravel directory and goto **Git Sync...** - Right-click the Laravel directory and goto **Git Sync...**
- Git Syncronization - Git Syncronization
- **Local Branch:** feature/localization-docs - **Local Branch:** feature/localization-docs
- **Remote Branch:** leave this blank - **Remote Branch:** leave this blank
- **Remote URL:** fork - **Remote URL:** fork
- Click **Push** - Click **Push**
- When asked for "username:" enter your GitHub *case-sensitive* username - When asked for "username:" enter your GitHub *case-sensitive* username
- When asked for "password:" enter your GitHub *case-sensitive* account - When asked for "password:" enter your GitHub *case-sensitive* account
Your branch has been successfully pushed to your fork on GitHub. Your branch has been successfully pushed to your fork on GitHub.
<a name='submitting-a-pull-request'></a> <a name="submitting-a-pull-request"></a>
## Submitting a Pull Request ## Submitting a Pull Request
The final step is to submit a pull request to the Laravel repository. This means that you are requesting that the Laravel team pull and merge your changes to the Laravel core. In your browser, visit your Laravel fork at [https://github.com/username/laravel](https://github.com/username/laravel). Click on **Pull Request**. Next, make sure you choose the proper base and head repositories and branches: The final step is to submit a pull request to the Laravel repository. This means that you are requesting that the Laravel team pull and merge your changes to the Laravel core. In your browser, visit your Laravel fork at [https://github.com/username/laravel](https://github.com/username/laravel). Click on **Pull Request**. Next, make sure you choose the proper base and head repositories and branches:
- **base repo:** laravel/laravel - **base repo:** laravel/laravel
- **base branch:** develop - **base branch:** develop
- **head repo:** username/laravel - **head repo:** username/laravel
- **head branch:** feature/localization-docs - **head branch:** feature/localization-docs
Use the form to write a more detailed description of the changes you made and why you made them. Finally, click **Send pull request**. That's it! The changes you made have been submitted to the Laravel team. Use the form to write a more detailed description of the changes you made and why you made them. Finally, click **Send pull request**. That's it! The changes you made have been submitted to the Laravel team.
<a name='whats-next'></a> <a name="whats-next"></a>
## What's Next? ## What's Next?
Do you have another feature you want to add or another bug you need to fix? Just follow the same instructions as before in the [Creating Branches](#creating-branches) section. Just remember to always create a new branch for every new feature/fix and don't forget to always base your new branches off of the *remotes/origin/develop* branch. Do you have another feature you want to add or another bug you need to fix? Just follow the same instructions as before in the [Creating Branches](#creating-branches) section. Just remember to always create a new branch for every new feature/fix and don't forget to always base your new branches off of the *remotes/origin/develop* branch.
<a name="config"></a>
# Session Configuration # Session Configuration
## Contents ## Contents
......
...@@ -25,6 +25,7 @@ The **Str** class also provides three convenient methods for manipulating string ...@@ -25,6 +25,7 @@ The **Str** class also provides three convenient methods for manipulating string
#### Limiting the number of characters in a string: #### Limiting the number of characters in a string:
echo Str::limit($string, 10); echo Str::limit($string, 10);
echo Str::limit_exact($string, 10);
#### Limiting the number of words in a string: #### Limiting the number of words in a string:
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
- [The Basics](#the-basics) - [The Basics](#the-basics)
- [Sections](#sections) - [Sections](#sections)
- [Blade Template Engine](#blade-template-engine) - [Blade Template Engine](#blade-template-engine)
- [Blade Control Structures](#blade-control-structures)
- [Blade Layouts](#blade-layouts) - [Blade Layouts](#blade-layouts)
<a name="the-basics"></a> <a name="the-basics"></a>
...@@ -63,7 +64,7 @@ Blade makes writing your views pure bliss. To create a blade view, simply name y ...@@ -63,7 +64,7 @@ Blade makes writing your views pure bliss. To create a blade view, simply name y
#### Echoing a variable using Blade: #### Echoing a variable using Blade:
Hello, {{$name}}. Hello, {{ $name }}.
#### Echoing function results using Blade: #### Echoing function results using Blade:
...@@ -80,15 +81,46 @@ Similarly, you can use **@render**, which behaves the same as **@include** excep ...@@ -80,15 +81,46 @@ Similarly, you can use **@render**, which behaves the same as **@include** excep
@render('admin.list') @render('admin.list')
#### Creating loops using Blade: #### Blade comments:
{{-- This is a comment --}}
<h1>Comments</h1> {{--
This is a
multi-line
comment.
--}}
> **Note:** Unlike HTML comments, Blade comments are not visible in the HTML source.
<a name='blade-control-structures'></a>
## Blade Control Structures
#### For Loop:
@for ($i = 0; $i <= count($comments); $i++)
The comment body is {{ $comments[$i] }}
@endfor
#### Foreach Loop:
@foreach ($comments as $comment) @foreach ($comments as $comment)
The comment body is {{$comment->body}}. The comment body is {{ $comment->body }}.
@endforeach @endforeach
#### Other Blade control structures: #### While Loop:
@while ($something)
I am still looping!
@endwhile
#### If Statement:
@if ( $message == true )
I'm displaying the message!
@endif
#### If Else Statement:
@if (count($comments) > 0) @if (count($comments) > 0)
I have comments! I have comments!
...@@ -96,15 +128,17 @@ Similarly, you can use **@render**, which behaves the same as **@include** excep ...@@ -96,15 +128,17 @@ Similarly, you can use **@render**, which behaves the same as **@include** excep
I have no comments! I have no comments!
@endif @endif
@for ($i =0; $i < count($comments) - 1; $i++) #### Else If Statement:
The comment body is {{$comments[$i]}}
@endfor
@while ($something) @if ( $message == 'success' )
I am still looping! It was a success!
@endwhile @elseif ( $message == 'error' )
An error occurred.
@else
Did it work?
@endif
#### The "for-else" control structure: #### For Else Statement:
@forelse ($posts as $post) @forelse ($posts as $post)
{{ $post->body }} {{ $post->body }}
...@@ -112,35 +146,18 @@ Similarly, you can use **@render**, which behaves the same as **@include** excep ...@@ -112,35 +146,18 @@ Similarly, you can use **@render**, which behaves the same as **@include** excep
There are not posts in the array! There are not posts in the array!
@endforelse @endforelse
<a name="blade-unless"></a> #### Unless Statement:
#### The "unless" control structure:
@unless(Auth::check()) @unless(Auth::check())
{{ HTML::link_to_route('login', 'Login'); }} Login
@endunless @endunless
// Equivalent... // Equivalent to...
<?php if ( ! Auth::check()): ?> <?php if ( ! Auth::check()): ?>
... Login
<?php endif; ?> <?php endif; ?>
<a name="blade-comments"></a>
#### Blade comments:
@if ($check)
{{-- This is a comment --}}
...
@endif
{{--
This is
a multi-line
comment.
--}}
> **Note:** Blade comments, unlike HTML comments, are not visible in the HTML source.
<a name="blade-layouts"></a> <a name="blade-layouts"></a>
## Blade Layouts ## Blade Layouts
...@@ -173,7 +190,9 @@ Great! Now, we can simply return the "profile" view from our route: ...@@ -173,7 +190,9 @@ Great! Now, we can simply return the "profile" view from our route:
The profile view will automatically use the "master" template thanks to Blade's **@layout** expression. The profile view will automatically use the "master" template thanks to Blade's **@layout** expression.
**Important:** The **@layout** call must always be on the very first line of the file, with no leading whitespaces or newline breaks. > **Important:** The **@layout** call must always be on the very first line of the file, with no leading whitespaces or newline breaks.
#### Appending with @parent
Sometimes you may want to only append to a section of a layout rather than overwrite it. For example, consider the navigation list in our "master" layout. Let's assume we just want to append a new list item. Here's how to do it: Sometimes you may want to only append to a section of a layout rather than overwrite it. For example, consider the navigation list in our "master" layout. Let's assume we just want to append a new list item. Here's how to do it:
...@@ -188,4 +207,4 @@ Sometimes you may want to only append to a section of a layout rather than overw ...@@ -188,4 +207,4 @@ Sometimes you may want to only append to a section of a layout rather than overw
Welcome to the profile page! Welcome to the profile page!
@endsection @endsection
Notice the **@parent** Blade construct? It will be replaced with the contents of the layout's navigation section, providing you with a beautiful and powerful method of performing layout extension and inheritance. **@parent** will be replaced with the contents of the layout's *navigation* section, providing you with a beautiful and powerful method of performing layout extension and inheritance.
...@@ -41,7 +41,7 @@ class Error { ...@@ -41,7 +41,7 @@ class Error {
{ {
$response = Event::first('500'); $response = Event::first('500');
return Response::prepare($response)->send(); echo Response::prepare($response)->render();
} }
exit(1); exit(1);
......
...@@ -526,7 +526,7 @@ class Form { ...@@ -526,7 +526,7 @@ class Form {
* @param array $attributes * @param array $attributes
* @return string * @return string
*/ */
public static function submit($value, $attributes = array()) public static function submit($value = null, $attributes = array())
{ {
return static::input('submit', null, $value, $attributes); return static::input('submit', null, $value, $attributes);
} }
...@@ -538,7 +538,7 @@ class Form { ...@@ -538,7 +538,7 @@ class Form {
* @param array $attributes * @param array $attributes
* @return string * @return string
*/ */
public static function reset($value, $attributes = array()) public static function reset($value = null, $attributes = array())
{ {
return static::input('reset', null, $value, $attributes); return static::input('reset', null, $value, $attributes);
} }
...@@ -570,7 +570,7 @@ class Form { ...@@ -570,7 +570,7 @@ class Form {
* @param array $attributes * @param array $attributes
* @return string * @return string
*/ */
public static function button($value, $attributes = array()) public static function button($value = null, $attributes = array())
{ {
return '<button'.HTML::attributes($attributes).'>'.HTML::entities($value).'</button>'; return '<button'.HTML::attributes($attributes).'>'.HTML::entities($value).'</button>';
} }
......
...@@ -206,7 +206,12 @@ class Router { ...@@ -206,7 +206,12 @@ class Router {
continue; continue;
} }
$uri = str_replace('(:bundle)', static::$bundle, $uri); $uri = ltrim(str_replace('(:bundle)', static::$bundle, $uri), '/');
if($uri == '')
{
$uri = '/';
}
// If the URI begins with a wildcard, we want to add this route to the // If the URI begins with a wildcard, we want to add this route to the
// array of "fallback" routes. Fallback routes are always processed // array of "fallback" routes. Fallback routes are always processed
......
...@@ -298,13 +298,29 @@ class Payload { ...@@ -298,13 +298,29 @@ class Payload {
$this->cookie($config); $this->cookie($config);
// Some session drivers implement the Sweeper interface meaning that // Some session drivers implement the Sweeper interface meaning that
// they must clean up expired sessions manually. If the driver is a // they must clean up expired sessions manually. Here we'll calculate
// sweeper, we'll calculate if we need to run garbage collection. // if we need to run garbage collection.
$sweepage = $config['sweepage']; $sweepage = $config['sweepage'];
if ($this->driver instanceof Sweeper and (mt_rand(1, $sweepage[1]) <= $sweepage[0])) if (mt_rand(1, $sweepage[1]) <= $sweepage[0])
{ {
$this->driver->sweep(time() - ($config['lifetime'] * 60)); $this->sweep();
}
}
/**
* Clean up expired sessions.
*
* If the session driver is a sweeper, it must clean up expired sessions
* from time to time. This method triggers garbage collection.
*
* @return void
*/
public function sweep()
{
if ($this->driver instanceof Sweeper)
{
$this->driver->sweep(time() - (Config::get('session.lifetime') * 60));
} }
} }
......
...@@ -131,6 +131,31 @@ class Str { ...@@ -131,6 +131,31 @@ class Str {
} }
/** /**
* Limit the number of chracters in a string including custom ending
*
* <code>
* // Returns "Taylor..."
* echo Str::limit_exact('Taylor Otwell', 9);
*
* // Limit the number of characters and append a custom ending
* echo Str::limit_exact('Taylor Otwell', 9, '---');
* </code>
*
* @param string $value
* @param int $limit
* @param string $end
* @return string
*/
public static function limit_exact($value, $limit = 100, $end = '...')
{
if (static::length($value) <= $limit) return $value;
$limit -= static::length($end);
return static::limit($value, $limit, $end);
}
/**
* Limit the number of words in a string. * Limit the number of words in a string.
* *
* <code> * <code>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Laravel - A PHP Framework For Web Artisans * Laravel - A PHP Framework For Web Artisans
* *
* @package Laravel * @package Laravel
* @version 3.2.6 * @version 3.2.7
* @author Taylor Otwell <taylorotwell@gmail.com> * @author Taylor Otwell <taylorotwell@gmail.com>
* @link http://laravel.com * @link http://laravel.com
*/ */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Laravel - A PHP Framework For Web Artisans * Laravel - A PHP Framework For Web Artisans
* *
* @package Laravel * @package Laravel
* @version 3.2.6 * @version 3.2.7
* @author Taylor Otwell <taylorotwell@gmail.com> * @author Taylor Otwell <taylorotwell@gmail.com>
* @link http://laravel.com * @link http://laravel.com
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment