Merge branch 'staging'
This commit is contained in:
commit
8a9acbccf0
|
@ -24,7 +24,7 @@
|
|||
"alpha" => ":attribute darf nur Buchstaben beinhalten.",
|
||||
"alpha_dash" => ":attribute sollte nur aus Buchstaben, Nummern und Bindestrichen 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.",
|
||||
"between" => array(
|
||||
"numeric" => ":attribute muss zwischen :min und :max liegen.",
|
||||
|
@ -32,10 +32,10 @@
|
|||
"string" => ":attribute muss zwischen :min und :max Zeichen lang sein.",
|
||||
),
|
||||
"confirmed" => ":attribute stimmt nicht mit der Bestätigung überein.",
|
||||
"count" => "The :attribute must have exactly :count selected elements.",
|
||||
"countbetween" => "The :attribute must have between :min and :max selected elements.",
|
||||
"countmax" => "The :attribute must have less than :max selected elements.",
|
||||
"countmin" => "The :attribute must have at least :min selected elements.",
|
||||
"count" => ":attribute muss genau :count ausgewählte Elemente haben.",
|
||||
"countbetween" => ":attribute muss zwischen :min und :max ausgewählte Elemente haben.",
|
||||
"countmax" => ":attribute muss weniger als :max ausgewählte Elemente haben.",
|
||||
"countmin" => ":attribute muss mindestens :min ausgewählte Elemente haben.",
|
||||
"different" => ":attribute und :other müssen verschieden sein.",
|
||||
"email" => ":attribute ist keine gültige Email-Adresse.",
|
||||
"exists" => "Der gewählte Wert für :attribute ist ungültig.",
|
||||
|
|
2
artisan
2
artisan
|
@ -4,7 +4,7 @@
|
|||
* Laravel - A PHP Framework For Web Artisans
|
||||
*
|
||||
* @package Laravel
|
||||
* @version 3.2.6
|
||||
* @version 3.2.7
|
||||
* @author Taylor Otwell <taylorotwell@gmail.com>
|
||||
* @link http://laravel.com
|
||||
*/
|
||||
|
|
|
@ -7,14 +7,20 @@ class Eloquent extends Driver {
|
|||
*
|
||||
* If the user is a guest, null should be returned.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int|object $token
|
||||
* @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 @@ public static function handles($uri)
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class Route extends Task {
|
|||
*/
|
||||
public function call($arguments = array())
|
||||
{
|
||||
if ( ! count($arguments) == 2)
|
||||
if ( count($arguments) != 2)
|
||||
{
|
||||
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
|
||||
// the developer on the CLI. If a route is found, we will not
|
||||
// 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))
|
||||
{
|
||||
|
|
|
@ -29,7 +29,15 @@ public function connect($config)
|
|||
// directly after the server name, so we'll create that first.
|
||||
$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}";
|
||||
}
|
||||
|
||||
return new PDO($dsn, $username, $password, $this->options($config));
|
||||
}
|
||||
|
|
|
@ -445,7 +445,7 @@ public function delete()
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function timestamp()
|
||||
public function timestamp()
|
||||
{
|
||||
$this->updated_at = new \DateTime;
|
||||
|
||||
|
@ -617,6 +617,8 @@ public function to_array()
|
|||
// to_array method, keying them both by name and ID.
|
||||
elseif (is_array($models))
|
||||
{
|
||||
$attributes[$name] = array();
|
||||
|
||||
foreach ($models as $id => $model)
|
||||
{
|
||||
$attributes[$name][$id] = $model->to_array();
|
||||
|
|
|
@ -26,7 +26,7 @@ class Pivot extends Model {
|
|||
public function __construct($table, $connection = null)
|
||||
{
|
||||
$this->pivot_table = $table;
|
||||
$this->connection = $connection;
|
||||
static::$connection = $connection;
|
||||
|
||||
parent::__construct(array(), true);
|
||||
}
|
||||
|
@ -41,14 +41,4 @@ public function table()
|
|||
return $this->pivot_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection used by the pivot table.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function connection()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
}
|
|
@ -85,12 +85,14 @@ public function results()
|
|||
/**
|
||||
* Insert a new record into the joining table of the association.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $joining
|
||||
* @param Model|int $id
|
||||
* @param array $attributes
|
||||
* @return bool
|
||||
*/
|
||||
public function attach($id, $attributes = array())
|
||||
{
|
||||
if ($id instanceof Model) $id = $id->get_key();
|
||||
|
||||
$joining = array_merge($this->join_record($id), $attributes);
|
||||
|
||||
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.
|
||||
*
|
||||
* @param int $ids
|
||||
* @param array|Model|int $ids
|
||||
* @return bool
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -7,17 +7,26 @@ class Has_One_Or_Many extends Relationship {
|
|||
/**
|
||||
* Insert a new record for the association.
|
||||
*
|
||||
* If save is successful, the model will be returned, otherwise false.
|
||||
*
|
||||
* @param Model|array $attributes
|
||||
* @return bool
|
||||
* @return Model|false
|
||||
*/
|
||||
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();
|
||||
|
||||
return $this->model->create($attributes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a record for the association.
|
||||
|
|
|
@ -621,7 +621,7 @@ public function lists($column, $key = null)
|
|||
// set the keys on the array of values using the array_combine
|
||||
// function provided by PHP, which should give us the proper
|
||||
// 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)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,18 @@ public function foreign(Table $table, Fluent $command)
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -224,18 +224,6 @@ public function rename(Table $table, Fluent $command)
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -210,18 +210,6 @@ public function rename(Table $table, Fluent $command)
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -213,18 +213,6 @@ public function rename(Table $table, Fluent $command)
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -224,18 +224,6 @@ public function rename(Table $table, Fluent $command)
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -2,6 +2,8 @@ # Laravel Change Log
|
|||
|
||||
## Contents
|
||||
|
||||
- [Laravel 3.2.7](#3.2.7)
|
||||
- [Upgrading From 3.2.6](#upgrade-3.2.7)
|
||||
- [Laravel 3.2.6](#3.2.6)
|
||||
- [Upgrading From 3.2.5](#upgrade-3.2.6)
|
||||
- [Laravel 3.2.5](#3.2.5)
|
||||
|
@ -37,6 +39,17 @@ ## Contents
|
|||
- [Laravel 3.1](#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>
|
||||
## Laravel 3.2.6
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Contributing to Laravel via Command-Line
|
||||
|
||||
## Contents
|
||||
|
||||
- [Getting Started](#getting-started)
|
||||
- [Forking Laravel](#forking-laravel)
|
||||
- [Cloning Laravel](#cloning-laravel)
|
||||
|
@ -10,19 +11,19 @@ ## Contents
|
|||
- [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
|
||||
|
||||
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.
|
||||
|
||||
<a name='forking-laravel'></a>
|
||||
<a name="forking-laravel"></a>
|
||||
## 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*).
|
||||
|
||||
<a name='cloning-laravel'></a>
|
||||
<a name="cloning-laravel"></a>
|
||||
## Cloning 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.
|
||||
|
||||
<a name='adding-your-fork'></a>
|
||||
<a name="adding-your-fork"></a>
|
||||
## Adding your Fork
|
||||
|
||||
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.
|
||||
|
||||
<a name='creating-branches'></a>
|
||||
<a name="creating-branches"></a>
|
||||
## 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:
|
||||
|
@ -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.
|
||||
|
||||
<a name='committing'></a>
|
||||
<a name="committing"></a>
|
||||
## 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:
|
||||
|
@ -87,10 +88,10 @@ ## Committing
|
|||
|
||||
# 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.
|
||||
- **-m** is the message that goes with your commit. Provide a brief explanation of what you added or changed.
|
||||
"- **-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.
|
||||
|
||||
<a name='pushing-to-your-fork'></a>
|
||||
<a name="pushing-to-your-fork"></a>
|
||||
## 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:
|
||||
|
@ -99,7 +100,7 @@ ## Pushing to your Fork
|
|||
|
||||
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
|
||||
|
||||
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:
|
||||
|
@ -111,7 +112,7 @@ ## Submitting a Pull Request
|
|||
|
||||
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?
|
||||
|
||||
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:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Contributing to Laravel using TortoiseGit
|
||||
|
||||
## Contents
|
||||
|
||||
- [Getting Started](#getting-started)
|
||||
- [Forking Laravel](#forking-laravel)
|
||||
- [Cloning Laravel](#cloning-laravel)
|
||||
|
@ -10,19 +11,19 @@ ## Contents
|
|||
- [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
|
||||
|
||||
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.
|
||||
|
||||
<a name='forking-laravel'></a>
|
||||
<a name="forking-laravel"></a>
|
||||
## 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*).
|
||||
|
||||
<a name='cloning-laravel'></a>
|
||||
<a name="cloning-laravel"></a>
|
||||
## Cloning Laravel
|
||||
|
||||
Open up Windows Explorer and create a new directory where you can make development changes to Laravel.
|
||||
|
@ -35,7 +36,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.
|
||||
|
||||
<a name='adding-your-fork'></a>
|
||||
<a name="adding-your-fork"></a>
|
||||
## Adding your Fork
|
||||
|
||||
After the cloning process is complete, it's time to add the fork you made as a **remote repository**.
|
||||
|
@ -49,7 +50,7 @@ ## Adding your Fork
|
|||
|
||||
Remember to replace *username* with your GitHub username. *This is case-sensitive*.
|
||||
|
||||
<a name='creating-branches'></a>
|
||||
<a name="creating-branches"></a>
|
||||
## 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.
|
||||
|
@ -67,7 +68,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.
|
||||
|
||||
<a name='committing'></a>
|
||||
<a name="committing"></a>
|
||||
##Committing
|
||||
|
||||
Now that you have finished coding and testing your changes, it's time to commit them to your local repository:
|
||||
|
@ -79,7 +80,7 @@ ## Creating Branches
|
|||
- **Changes made:** Check all changed/added files
|
||||
- Click **OK**
|
||||
|
||||
<a name='pushing-to-your-fork'></a>
|
||||
<a name="pushing-to-your-fork"></a>
|
||||
## 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:
|
||||
|
@ -95,7 +96,7 @@ ## Pushing to your Fork
|
|||
|
||||
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
|
||||
|
||||
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:
|
||||
|
@ -107,7 +108,7 @@ ## Submitting a Pull Request
|
|||
|
||||
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?
|
||||
|
||||
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.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<a name="config"></a>
|
||||
# Session Configuration
|
||||
|
||||
## Contents
|
||||
|
|
|
@ -25,6 +25,7 @@ ## Word & Character Limiting
|
|||
#### Limiting the number of characters in a string:
|
||||
|
||||
echo Str::limit($string, 10);
|
||||
echo Str::limit_exact($string, 10);
|
||||
|
||||
#### Limiting the number of words in a string:
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ ## Contents
|
|||
- [The Basics](#the-basics)
|
||||
- [Sections](#sections)
|
||||
- [Blade Template Engine](#blade-template-engine)
|
||||
- [Blade Control Structures](#blade-control-structures)
|
||||
- [Blade Layouts](#blade-layouts)
|
||||
|
||||
<a name="the-basics"></a>
|
||||
|
@ -80,15 +81,46 @@ #### Render a view:
|
|||
|
||||
@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)
|
||||
The comment body is {{ $comment->body }}.
|
||||
@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)
|
||||
I have comments!
|
||||
|
@ -96,15 +128,17 @@ #### Other Blade control structures:
|
|||
I have no comments!
|
||||
@endif
|
||||
|
||||
@for ($i =0; $i < count($comments) - 1; $i++)
|
||||
The comment body is {{$comments[$i]}}
|
||||
@endfor
|
||||
#### Else If Statement:
|
||||
|
||||
@while ($something)
|
||||
I am still looping!
|
||||
@endwhile
|
||||
@if ( $message == 'success' )
|
||||
It was a success!
|
||||
@elseif ( $message == 'error' )
|
||||
An error occurred.
|
||||
@else
|
||||
Did it work?
|
||||
@endif
|
||||
|
||||
#### The "for-else" control structure:
|
||||
#### For Else Statement:
|
||||
|
||||
@forelse ($posts as $post)
|
||||
{{ $post->body }}
|
||||
|
@ -112,35 +146,18 @@ #### The "for-else" control structure:
|
|||
There are not posts in the array!
|
||||
@endforelse
|
||||
|
||||
<a name="blade-unless"></a>
|
||||
#### The "unless" control structure:
|
||||
#### Unless Statement:
|
||||
|
||||
@unless(Auth::check())
|
||||
{{ HTML::link_to_route('login', 'Login'); }}
|
||||
Login
|
||||
@endunless
|
||||
|
||||
// Equivalent...
|
||||
// Equivalent to...
|
||||
|
||||
<?php if ( ! Auth::check()): ?>
|
||||
...
|
||||
Login
|
||||
<?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>
|
||||
## Blade Layouts
|
||||
|
||||
|
@ -173,7 +190,9 @@ ## Blade Layouts
|
|||
|
||||
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:
|
||||
|
||||
|
@ -188,4 +207,4 @@ ## Blade Layouts
|
|||
Welcome to the profile page!
|
||||
@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 @@ public static function exception($exception, $trace = true)
|
|||
{
|
||||
$response = Event::first('500');
|
||||
|
||||
return Response::prepare($response)->send();
|
||||
echo Response::prepare($response)->render();
|
||||
}
|
||||
|
||||
exit(1);
|
||||
|
|
|
@ -526,7 +526,7 @@ protected static function checkable($type, $name, $value, $checked, $attributes)
|
|||
* @param array $attributes
|
||||
* @return string
|
||||
*/
|
||||
public static function submit($value, $attributes = array())
|
||||
public static function submit($value = null, $attributes = array())
|
||||
{
|
||||
return static::input('submit', null, $value, $attributes);
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ public static function submit($value, $attributes = array())
|
|||
* @param array $attributes
|
||||
* @return string
|
||||
*/
|
||||
public static function reset($value, $attributes = array())
|
||||
public static function reset($value = null, $attributes = array())
|
||||
{
|
||||
return static::input('reset', null, $value, $attributes);
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ public static function image($url, $name = null, $attributes = array())
|
|||
* @param array $attributes
|
||||
* @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>';
|
||||
}
|
||||
|
|
|
@ -206,7 +206,12 @@ public static function register($method, $route, $action)
|
|||
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
|
||||
// array of "fallback" routes. Fallback routes are always processed
|
||||
|
|
|
@ -298,13 +298,29 @@ public function save()
|
|||
$this->cookie($config);
|
||||
|
||||
// Some session drivers implement the Sweeper interface meaning that
|
||||
// they must clean up expired sessions manually. If the driver is a
|
||||
// sweeper, we'll calculate if we need to run garbage collection.
|
||||
// they must clean up expired sessions manually. Here we'll calculate
|
||||
// if we need to run garbage collection.
|
||||
$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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -130,6 +130,31 @@ public static function limit($value, $limit = 100, $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.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Laravel - A PHP Framework For Web Artisans
|
||||
*
|
||||
* @package Laravel
|
||||
* @version 3.2.6
|
||||
* @version 3.2.7
|
||||
* @author Taylor Otwell <taylorotwell@gmail.com>
|
||||
* @link http://laravel.com
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Laravel - A PHP Framework For Web Artisans
|
||||
*
|
||||
* @package Laravel
|
||||
* @version 3.2.6
|
||||
* @version 3.2.7
|
||||
* @author Taylor Otwell <taylorotwell@gmail.com>
|
||||
* @link http://laravel.com
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue