Merge branch 'staging'

This commit is contained in:
Taylor Otwell 2012-09-01 21:50:41 -05:00
commit 8a9acbccf0
29 changed files with 252 additions and 190 deletions

View File

@ -24,7 +24,7 @@
"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 @@
"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.",

View File

@ -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
*/ */

View File

@ -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;
} }
} }

View File

@ -191,7 +191,7 @@ public static function handles($uri)
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;
} }

View File

@ -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 @@ protected function route()
// 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))
{ {

View File

@ -29,7 +29,15 @@ public function connect($config)
// 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 : '';
//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}"; $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));
} }

View File

@ -445,7 +445,7 @@ public function delete()
* *
* @return void * @return void
*/ */
protected function timestamp() public function timestamp()
{ {
$this->updated_at = new \DateTime; $this->updated_at = new \DateTime;
@ -617,6 +617,8 @@ public function to_array()
// 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();

View File

@ -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 @@ public function table()
return $this->pivot_table; return $this->pivot_table;
} }
/**
* Get the connection used by the pivot table.
*
* @return string
*/
public function connection()
{
return $this->connection;
}
} }

View File

@ -85,12 +85,14 @@ public function results()
/** /**
* 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 @@ public function attach($id, $attributes = array())
/** /**
* 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();
} }

View File

@ -7,17 +7,26 @@ 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->set_attribute($this->foreign_key(), $this->base->get_key());
return $attributes->save() ? $attributes : false;
}
else
{
$attributes[$this->foreign_key()] = $this->base->get_key(); $attributes[$this->foreign_key()] = $this->base->get_key();
return $this->model->create($attributes); return $this->model->create($attributes);
} }
}
/** /**
* Update a record for the association. * Update a record for the association.

View File

@ -621,7 +621,7 @@ public function lists($column, $key = null)
// 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)
{ {

View File

@ -50,6 +50,18 @@ public function foreign(Table $table, Fluent $command)
return $sql; return $sql;
} }
/**
* 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.
* *

View File

@ -224,18 +224,6 @@ public function rename(Table $table, Fluent $command)
return 'RENAME TABLE '.$this->wrap($table).' TO '.$this->wrap($command->name); return 'RENAME TABLE '.$this->wrap($table).' TO '.$this->wrap($command->name);
} }
/**
* 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.
* *

View File

@ -210,18 +210,6 @@ public function rename(Table $table, Fluent $command)
return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name); return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name);
} }
/**
* 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.
* *

View File

@ -213,18 +213,6 @@ public function rename(Table $table, Fluent $command)
return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name); return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name);
} }
/**
* 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.
* *

View File

@ -224,18 +224,6 @@ public function rename(Table $table, Fluent $command)
return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name); return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name);
} }
/**
* 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.
* *

View File

@ -2,6 +2,8 @@ # Laravel Change Log
## 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 @@ ## Contents
- [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

View File

@ -1,28 +1,29 @@
# Contributing to Laravel via Command-Line # Contributing to Laravel via Command-Line
## Contents ## Contents
- [Getting Started](#getting-started)
- [Forking Laravel](#forking-laravel)
- [Cloning Laravel](#cloning-laravel)
- [Adding your Fork](#adding-your-fork)
- [Creating Branches](#creating-branches)
- [Committing](#committing)
- [Submitting a Pull Request](#submitting-a-pull-request)
- [What's Next?](#whats-next)
<a name='getting-started'></a> - [Getting Started](#getting-started)
- [Forking Laravel](#forking-laravel)
- [Cloning Laravel](#cloning-laravel)
- [Adding your Fork](#adding-your-fork)
- [Creating Branches](#creating-branches)
- [Committing](#committing)
- [Submitting a Pull Request](#submitting-a-pull-request)
- [What's Next?](#whats-next)
<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 @@ ## Cloning Laravel
> **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 @@ ## Adding your Fork
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 @@ ## Creating Branches
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 @@ ## Committing
# 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 @@ ## Pushing to your Fork
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:

View File

@ -1,47 +1,48 @@
# Contributing to Laravel using TortoiseGit # Contributing to Laravel using TortoiseGit
## Contents ## Contents
- [Getting Started](#getting-started)
- [Forking Laravel](#forking-laravel)
- [Cloning Laravel](#cloning-laravel)
- [Adding your Fork](#adding-your-fork)
- [Creating Branches](#creating-branches)
- [Committing](#committing)
- [Submitting a Pull Request](#submitting-a-pull-request)
- [What's Next?](#whats-next)
<a name='getting-started'></a> - [Getting Started](#getting-started)
- [Forking Laravel](#forking-laravel)
- [Cloning Laravel](#cloning-laravel)
- [Adding your Fork](#adding-your-fork)
- [Creating Branches](#creating-branches)
- [Committing](#committing)
- [Submitting a Pull Request](#submitting-a-pull-request)
- [What's Next?](#whats-next)
<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 @@ ## Adding your Fork
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,19 +68,19 @@ ## Creating Branches
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:
@ -95,19 +96,19 @@ ## Pushing to your Fork
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.

View File

@ -1,4 +1,3 @@
<a name="config"></a>
# Session Configuration # Session Configuration
## Contents ## Contents

View File

@ -25,6 +25,7 @@ ## Word & Character Limiting
#### 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:

View File

@ -5,6 +5,7 @@ ## Contents
- [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 Template Engine
#### 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 @@ #### Render a view:
@render('admin.list') @render('admin.list')
#### Creating loops using Blade: #### Blade comments:
<h1>Comments</h1> {{-- This is a comment --}}
{{--
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 @@ #### Other Blade control structures:
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 @@ #### The "for-else" control structure:
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 @@ ## Blade Layouts
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 @@ ## Blade Layouts
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.

View File

@ -41,7 +41,7 @@ public static function exception($exception, $trace = true)
{ {
$response = Event::first('500'); $response = Event::first('500');
return Response::prepare($response)->send(); echo Response::prepare($response)->render();
} }
exit(1); exit(1);

View File

@ -526,7 +526,7 @@ protected static function checkable($type, $name, $value, $checked, $attributes)
* @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 @@ public static function submit($value, $attributes = array())
* @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 @@ public static function image($url, $name = null, $attributes = array())
* @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>';
} }

View File

@ -206,7 +206,12 @@ public static function register($method, $route, $action)
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

View File

@ -298,13 +298,29 @@ public function save()
$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));
} }
} }

View File

@ -130,6 +130,31 @@ public static function limit($value, $limit = 100, $end = '...')
return substr($value, 0, $limit).$end; return substr($value, 0, $limit).$end;
} }
/**
* 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.
* *

View File

@ -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
*/ */

View File

@ -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
*/ */