Commit f3d75647 authored by Chris Berthe's avatar Chris Berthe

Merge remote-tracking branch 'upstream/develop' into develop

parents 17e75a97 4d7d67dd
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '→ السابق',
'next' => 'التالي ←',
);
\ No newline at end of file
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used
| by the validator class. Some of the rules contain multiple versions,
| such as the size (max, min, between) rules. These versions are used
| for different input types such as strings and files.
|
| These language lines may be easily changed to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
"accepted" => "القيمة :attribute يجب أن تكون مقبولة.",
"active_url" => "القيمة :attribute تمثل عنوان موقع إنترنت غير صحيح.",
"after" => "القيمة :attribute يجب أن تكون بعد تاريخ :date.",
"alpha" => "القيمة :attribute يمكنها أن تحتوي على أحرف فقط.",
"alpha_dash" => "القيمة :attribute يمكنها أن تحتوي على أحرف و أرقام و إشارة الناقص فقط.",
"alpha_num" => "القيمة :attribute يمكنها أن تحتوي على أحرف و أرقام فقط.",
"before" => "القيمة :attribute يجب أن تكون قبل تاريخ :date.",
"between" => array(
"numeric" => "القيمة :attribute يجب أن تكون بين :min و :max.",
"file" => "الملف :attribute يجب أن يكون بحجم من :min إلى :max كيلوبايت.",
"string" => "النص :attribute يجب أن يكون بطول من :min إلى :max حرف.",
),
"confirmed" => "القيمة :attribute التأكيدية غير مطابقة.",
"different" => "القيمتان :attribute و :other يجب أن تختلفان.",
"email" => "القيمة :attribute تمثل بريد إلكتروني غير صحيح.",
"exists" => "القيمة المختارة :attribute غير موجودة.",
"image" => "القيمة :attribute يجب أن تكون صورة.",
"in" => "القيمة المختارة :attribute غير موجودة.",
"integer" => "القيمة :attribute يجب أن تكون رقماً.",
"ip" => "القيمة :attribute يجب أن تمثل عنوان بروتوكول إنترنت صحيح.",
"match" => "القيمة :attribute هي بتنسيق غير صحيح.",
"max" => array(
"numeric" => "القيمة :attribute يجب أن تكون أقل من :max.",
"file" => "الملف :attribute يجب أن يكون بحجم أقل من :max كيلوبايت.",
"string" => "النص :attribute يجب أن يكون بطول أقل من :max حرف.",
),
"mimes" => "القيمة :attribute يجب أن تكون ملف من نوع: :values.",
"min" => array(
"numeric" => "القيمة :attribute يجب أن تساوي :min على الأقل.",
"file" => "الملف :attribute يجب أن يكون بحجم :min كيلوبايت على الأقل.",
"string" => "النص :attribute يجب أن يكون بطول :min حرف على الأقل.",
),
"not_in" => "القيمة :attribute المختارة غير صحيحة.",
"numeric" => "القيمة :attribute يجب أن تكون رقماً.",
"required" => "القيمة :attribute مطلوبة.",
"same" => "القيمتان :attribute و :other يجب أن تتطابقان.",
"size" => array(
"numeric" => "القيمة :attribute يجب أن تكون بحجم :size.",
"file" => "الملف :attribute يجب أن يكون بحجم :size كيلوبايت.",
"string" => "النص :attribute يجب أن يكون بطول :size حرف.",
),
"unique" => "القيمة :attribute تم استخدامها من قبل.",
"url" => "التنسيق :attribute غير صحيح.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);
\ No newline at end of file
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '&laquo; Zur&uuml;ck',
'next' => 'Weiter &raquo;',
);
\ No newline at end of file
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used
| by the validator class. Some of the rules contain multiple versions,
| such as the size (max, min, between) rules. These versions are used
| for different input types such as strings and files.
|
| These language lines may be easily changed to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
"accepted" => ":attribute muss akzeptiert werden.",
"active_url" => ":attribute ist keine g&uuml;ltige URL.",
"after" => ":attribute muss ein Datum nach dem :date sein.",
"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.",
"before" => ":attribute muss ein Datum vor dem :date sein.",
"between" => array(
"numeric" => ":attribute muss zwischen :min und :max liegen.",
"file" => ":attribute muss zwischen :min und :max Kilobytes gro&szlig; sein.",
"string" => ":attribute muss zwischen :min und :max Zeichen lang sein.",
),
"confirmed" => ":attribute stimmt nicht mit der Best&auml;tigung &uuml;berein.",
"different" => ":attribute und :other m&uuml;ssen verschieden sein.",
"email" => ":attribute ist keine g&uuml;ltige Email-Adresse.",
"exists" => "Der gew&auml;hlte Wert f&uuml;r :attribute ist ung&uuml;ltig.",
"image" => ":attribute muss ein Bild sein.",
"in" => "Der gew&auml;hlte Wert f&uuml;r :attribute ist ung&uuml;ltig.",
"integer" => ":attribute muss eine ganze Zahl sein.",
"ip" => ":attribute muss eine g&uuml;ltige IP-Adresse sein.",
"match" => ":attribute hat ein ung&uuml;ltiges Format.",
"max" => array(
"numeric" => ":attribute muss kleiner als :max sein.",
"file" => ":attribute muss kleiner als :max Kilobytes gro&szlig; sein.",
"string" => ":attribute muss k&uuml;rzer als :max Zeichen sein.",
),
"mimes" => ":attribute muss den Dateityp :values haben.",
"min" => array(
"numeric" => ":attribute muss gr&ouml;&szlig;er als :min sein.",
"file" => ":attribute muss gr&ouml;&szlig;er als :min Kilobytes gro&szlig; sein.",
"string" => ":attribute muss l&auml;nger als :min Zeichen sein.",
),
"not_in" => "Der gew&auml;hlte Wert f&uuml;r :attribute ist ung&uuml;ltig.",
"numeric" => ":attribute muss eine Zahl sein.",
"required" => ":attribute muss aufgef&uuml;llt sein.",
"same" => ":attribute und :other m&uuml;ssen &uuml;bereinstimmen.",
"size" => array(
"numeric" => ":attribute muss gleich :size sein.",
"file" => ":attribute muss :size Kilobyte gro&szlig; sein.",
"string" => ":attribute muss :size Zeichen lang sein.",
),
"unique" => ":attribute ist schon vergeben.",
"url" => "Das Format von :attribute ist ung&uuml;ltig.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);
\ No newline at end of file
......@@ -278,7 +278,7 @@ class Blade {
*/
protected static function compile_structure_closings($value)
{
$pattern = '/(\s*)@(endif|endforeach|endfor|endwhile)(\s*)/';
$pattern = '/(\s*)@(endif|endforeach|endfor|endwhile|break)(\s*)/';
return preg_replace($pattern, '$1<?php $2; ?>$3', $value);
}
......
......@@ -194,7 +194,7 @@ class Connection {
return $statement->rowCount();
}
// For insert statements that use the "returning" clause, which is allowed
// by databsae systems such as Postgres, we need to actually return the
// by database systems such as Postgres, we need to actually return the
// real query result so the consumer can get the ID.
elseif (stripos($sql, 'insert') === 0 and stripos($sql, 'returning') !== false)
{
......
......@@ -253,7 +253,27 @@ abstract class Model {
*/
public function _with($includes)
{
$this->includes = (array) $includes;
$includes = (array) $includes;
$all_includes = array();
foreach($includes as $include)
{
$nested = explode('.', $include);
$inc = array();
foreach($nested as $relation)
{
$inc[] = $relation;
$all_includes[] = implode('.', $inc);
}
}
//remove duplicates and reset the array keys.
$this->includes = array_values(array_unique($all_includes));
return $this;
}
......
......@@ -21,7 +21,7 @@ abstract class Grammar extends \Laravel\Database\Grammar {
// command is being executed and the referenced table are wrapped.
$table = $this->wrap($table);
$on = $this->wrap($command->on);
$on = $this->wrap_table($command->on);
// Next we need to columnize both the command table's columns as well as
// the columns referenced by the foreign key. We'll cast the referenced
......
......@@ -418,4 +418,4 @@ class MySQL extends Grammar {
return 'BLOB';
}
}
\ No newline at end of file
}
......@@ -393,9 +393,7 @@ class Table {
{
$parameters = array_merge(compact('type'), $parameters);
$this->commands[] = new Fluent($parameters);
return end($this->commands);
return $this->commands[] = new Fluent($parameters);
}
/**
......@@ -409,9 +407,7 @@ class Table {
{
$parameters = array_merge(compact('type'), $parameters);
$this->columns[] = new Fluent($parameters);
return end($this->columns);
return $this->columns[] = new Fluent($parameters);
}
}
\ No newline at end of file
......@@ -63,7 +63,7 @@ It is common to limit access to certain routes only to logged in users. In Larav
To protect a route, simply attach the **auth** filter:
Route::get('admin', array('before' => 'auth', function() {});
Route::get('admin', array('before' => 'auth', function() {}));
> **Note:** You are free to edit the **auth** filter however you like. A default implementation is located in **application/routes.php**.
......
......@@ -4,6 +4,7 @@
- [Installation & Setup](/docs/install)
- [Requirements](/docs/install#requirements)
- [Installation](/docs/install#installation)
- [Server Configuration: Why Public?](/docs/install#server-configuration)
- [Basic Configuration](/docs/install#basic-configuration)
- [Environments](/docs/install#environments)
- [Cleaner URLs](/docs/install#cleaner-urls)
......
......@@ -65,7 +65,7 @@ Need to retrieve an entire table? Just use the static **all** method:
echo $user->email;
}
Of course, retrieving an entire table isn't very helpful. Thankfully, **every method that is available through the fluent query builder is available in Eloquent**. Just begin querying your model with a static call to one of the [query builder](/docs/database/query) methods, and execute the query using the **get** or **first** method. The get method will return an array of models, while the first method will return a single model:
Of course, retrieving an entire table isn't very helpful. Thankfully, **every method that is available through the fluent query builder is available in Eloquent**. Just begin querying your model with a static call to one of the [query builder](/docs/database/fluent) methods, and execute the query using the **get** or **first** method. The get method will return an array of models, while the first method will return a single model:
$user = User::where('email', '=', $email)->first();
......
......@@ -145,4 +145,10 @@ Sometimes you may wish to merge or replace the current input. Here's how:
#### Replacing the entire input array with new data:
Input::merge(array('doctor' => 'Bones', 'captain' => 'Kirk'));
\ No newline at end of file
Input::merge(array('doctor' => 'Bones', 'captain' => 'Kirk'));
## Clearing Input
To clear all input data for the current request, using the `clear()` method, for example:
Input::clear();
\ No newline at end of file
......@@ -4,6 +4,7 @@
- [Requirements](#requirements)
- [Installation](#installation)
- [Server Configuration: Why Public?](#server-configuration)
- [Basic Configuration](#basic-configuration)
- [Environments](#environments)
- [Cleaner URLs](#cleaner-urls)
......@@ -37,8 +38,30 @@ Installing the following goodies will help you take full advantage of Laravel, b
If you are having problems installing, try the following:
- Make sure the **public** directory is the document root of your web server.
- Make sure the **public** directory is the document root of your web server. (see: Server Configuration below)
- If you are using mod_rewrite, set the **index** option in **application/config/application.php** to an empty string.
- Verify that your storage folder and the folders within in are writable by your web server.
<a name="server-configuration"></a>
## Server Configuration: Why Public?
Like most web-development frameworks, Laravel is designed to protect your application code, bundles, and local storage by placing only files that are necessarily public in the web server's DocumentRoot. This prevents some types of server misconfiguration from making your code (including database passwords and other configuration data) accessible through the web server. It's best to be safe.
In this example let's imagine that we installed Laravel to the directory **/Users/JonSnow/Sites/MySite**.
A very basic example of an Apache VirtualHost configuration for MySite might look like this.
<VirtualHost *:80>
DocumentRoot /Users/JonSnow/Sites/MySite/public
ServerName mysite.local
</VirtualHost>
Notice that while we installed to **/Users/JonSnow/Sites/MySite** our DocumentRoot points to **/Users/JonSnow/Sites/MySite/public**.
Pointing the DocumentRoot to the public folder is a commonly used best-practice. However, you may need to use Laravel on a host that does not allow you to update your DocumentRoot. This is possible, but before resigning to this option it's best to contact your host and verify that you are unable to change your DocumentRoot to increase the security of your application.
More information about how to use the public folder can be found on the [Laravel Forums](http://forums.laravel.com/viewtopic.php?pid=10023#p10023).
<a name="basic-configuration"></a>
## Basic Configuration
......@@ -70,7 +93,7 @@ Next, create an **application/config/local** directory. Any files and options yo
);
In this example, the local **URL** option will override the **URL** option in **application/config/application.php**. Notice that you only need to specify the options you wish to override.
In this example, the local **URL** option will override the **URL** option in **application/config/application.php**. Notice that you only need to specify the options you wish to override.
Isn't it easy? Of course, you are free to create as many environments as you wish!
......
......@@ -12,7 +12,7 @@
<a name="the-basics"></a>
## The Basics
Almost every interactive web application needs to validate data. For instance, a registration form probably requires the password to be confirmed. Maybe the e-mail address must be unique. Validating data can be a cumbersome process. Thankfully, it isn't in Laravel. The Validator class provides as awesome array of validation helpers to make validating your data a breeze. Let's walk through an example:
Almost every interactive web application needs to validate data. For instance, a registration form probably requires the password to be confirmed. Maybe the e-mail address must be unique. Validating data can be a cumbersome process. Thankfully, it isn't in Laravel. The Validator class provides an awesome array of validation helpers to make validating your data a breeze. Let's walk through an example:
#### Get an array of data you want to validate:
......
......@@ -164,6 +164,8 @@ 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.
**Important:** The **@layout** call must always be on the very first line of the file, with no leading whitespaces or newline breaks.
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:
@layout('master')
......
......@@ -427,7 +427,7 @@ class Form {
$html[] = static::option($value, $display, $selected);
}
return '<optgroup label="'.HTML::entities($label).'">'.implode('', $html).'</option>';
return '<optgroup label="'.HTML::entities($label).'">'.implode('', $html).'</optgroup>';
}
/**
......
......@@ -287,4 +287,13 @@ class Input {
Request::foundation()->request->replace($input);
}
/**
* Clear the input for the current request.
* @return void
*/
public static function clear()
{
Request::foundation()->request->replace(array());
}
}
\ No newline at end of file
......@@ -102,7 +102,8 @@ class Request {
*/
public static function ip($default = '0.0.0.0')
{
return value(static::foundation()->getClientIp(), $default);
$client_ip = static::foundation()->getClientIp();
return $client_ip === NULL ? $default : $client_ip;
}
/**
......
<?php namespace Laravel;
<?php namespace Laravel; use Closure;
class Session {
......
......@@ -118,6 +118,11 @@ class View implements ArrayAccess {
*/
public static function exists($view, $return_path = false)
{
if (starts_with($view, 'name: ') and array_key_exists($name = substr($view, 6), static::$names))
{
$view = static::$names[$name];
}
list($bundle, $view) = Bundle::parse($view);
$view = str_replace('.', '/', $view);
......
......@@ -10,7 +10,7 @@
/*
|----------------------------------------------------------------
| Application Environemtns
| Application Environments
|----------------------------------------------------------------
|
| Laravel takes a dead simple approach to environments, and we
......
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