diff --git a/application/language/ar/pagination.php b/application/language/ar/pagination.php new file mode 100644 index 00000000..37135719 --- /dev/null +++ b/application/language/ar/pagination.php @@ -0,0 +1,19 @@ + '→ السابق', + 'next' => 'التالي ←', + +); \ No newline at end of file diff --git a/application/language/ar/validation.php b/application/language/ar/validation.php new file mode 100644 index 00000000..cb15db34 --- /dev/null +++ b/application/language/ar/validation.php @@ -0,0 +1,99 @@ + "القيمة :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 diff --git a/application/language/de/pagination.php b/application/language/de/pagination.php new file mode 100644 index 00000000..9fd96322 --- /dev/null +++ b/application/language/de/pagination.php @@ -0,0 +1,19 @@ + '« Zurück', + 'next' => 'Weiter »', + +); \ No newline at end of file diff --git a/application/language/de/validation.php b/application/language/de/validation.php new file mode 100644 index 00000000..87189410 --- /dev/null +++ b/application/language/de/validation.php @@ -0,0 +1,99 @@ + ":attribute muss akzeptiert werden.", + "active_url" => ":attribute ist keine gü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ß sein.", + "string" => ":attribute muss zwischen :min und :max Zeichen lang sein.", + ), + "confirmed" => ":attribute stimmt nicht mit der Bestätigung überein.", + "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.", + "image" => ":attribute muss ein Bild sein.", + "in" => "Der gewählte Wert für :attribute ist ungültig.", + "integer" => ":attribute muss eine ganze Zahl sein.", + "ip" => ":attribute muss eine gültige IP-Adresse sein.", + "match" => ":attribute hat ein ungültiges Format.", + "max" => array( + "numeric" => ":attribute muss kleiner als :max sein.", + "file" => ":attribute muss kleiner als :max Kilobytes groß sein.", + "string" => ":attribute muss kürzer als :max Zeichen sein.", + ), + "mimes" => ":attribute muss den Dateityp :values haben.", + "min" => array( + "numeric" => ":attribute muss größer als :min sein.", + "file" => ":attribute muss größer als :min Kilobytes groß sein.", + "string" => ":attribute muss länger als :min Zeichen sein.", + ), + "not_in" => "Der gewählte Wert für :attribute ist ungültig.", + "numeric" => ":attribute muss eine Zahl sein.", + "required" => ":attribute muss aufgefüllt sein.", + "same" => ":attribute und :other müssen übereinstimmen.", + "size" => array( + "numeric" => ":attribute muss gleich :size sein.", + "file" => ":attribute muss :size Kilobyte groß sein.", + "string" => ":attribute muss :size Zeichen lang sein.", + ), + "unique" => ":attribute ist schon vergeben.", + "url" => "Das Format von :attribute ist ungü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 diff --git a/laravel/blade.php b/laravel/blade.php index 12381482..ad1b6485 100644 --- a/laravel/blade.php +++ b/laravel/blade.php @@ -278,7 +278,7 @@ protected static function compile_structure_openings($value) */ 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$3', $value); } diff --git a/laravel/database/connection.php b/laravel/database/connection.php index b3774fd4..189d2ca2 100644 --- a/laravel/database/connection.php +++ b/laravel/database/connection.php @@ -194,7 +194,7 @@ public function query($sql, $bindings = array()) 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) { diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 64802cdc..aba0df12 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -253,7 +253,27 @@ public static function all() */ 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; } diff --git a/laravel/database/schema/grammars/grammar.php b/laravel/database/schema/grammars/grammar.php index 1d3390a1..da93aa64 100644 --- a/laravel/database/schema/grammars/grammar.php +++ b/laravel/database/schema/grammars/grammar.php @@ -21,7 +21,7 @@ public function foreign(Table $table, Fluent $command) // 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 diff --git a/laravel/database/schema/grammars/mysql.php b/laravel/database/schema/grammars/mysql.php index fa725136..a31e6e08 100644 --- a/laravel/database/schema/grammars/mysql.php +++ b/laravel/database/schema/grammars/mysql.php @@ -418,4 +418,4 @@ protected function type_blob(Fluent $column) return 'BLOB'; } -} \ No newline at end of file +} diff --git a/laravel/database/schema/table.php b/laravel/database/schema/table.php index 570c5405..ba187df5 100644 --- a/laravel/database/schema/table.php +++ b/laravel/database/schema/table.php @@ -393,9 +393,7 @@ protected function command($type, $parameters = array()) { $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 @@ protected function column($type, $parameters = array()) { $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 diff --git a/laravel/documentation/auth/usage.md b/laravel/documentation/auth/usage.md index e02747a0..8a9a0650 100644 --- a/laravel/documentation/auth/usage.md +++ b/laravel/documentation/auth/usage.md @@ -63,7 +63,7 @@ ## Protecting Routes 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**. diff --git a/laravel/documentation/contents.md b/laravel/documentation/contents.md index 1d5ce11e..5a512ad1 100644 --- a/laravel/documentation/contents.md +++ b/laravel/documentation/contents.md @@ -4,6 +4,7 @@ ### General - [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) diff --git a/laravel/documentation/database/eloquent.md b/laravel/documentation/database/eloquent.md index 0706b7d9..c2afc7a2 100644 --- a/laravel/documentation/database/eloquent.md +++ b/laravel/documentation/database/eloquent.md @@ -65,7 +65,7 @@ ## Retrieving Models 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(); diff --git a/laravel/documentation/input.md b/laravel/documentation/input.md index 14221ecd..4387721e 100644 --- a/laravel/documentation/input.md +++ b/laravel/documentation/input.md @@ -145,4 +145,10 @@ #### Merging new data into the current input: #### 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 diff --git a/laravel/documentation/install.md b/laravel/documentation/install.md index 12f12951..b3312366 100644 --- a/laravel/documentation/install.md +++ b/laravel/documentation/install.md @@ -4,6 +4,7 @@ ## Contents - [Requirements](#requirements) - [Installation](#installation) +- [Server Configuration: Why Public?](#server-configuration) - [Basic Configuration](#basic-configuration) - [Environments](#environments) - [Cleaner URLs](#cleaner-urls) @@ -37,8 +38,30 @@ ### Problems? 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. + + +## 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. + + + DocumentRoot /Users/JonSnow/Sites/MySite/public + ServerName mysite.local + + +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). + ## Basic Configuration @@ -70,7 +93,7 @@ ## Environments ); -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! diff --git a/laravel/documentation/validation.md b/laravel/documentation/validation.md index 49401439..4da4683c 100644 --- a/laravel/documentation/validation.md +++ b/laravel/documentation/validation.md @@ -12,7 +12,7 @@ ## Contents ## 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: diff --git a/laravel/documentation/views/templating.md b/laravel/documentation/views/templating.md index 8849f0e1..a2273c19 100644 --- a/laravel/documentation/views/templating.md +++ b/laravel/documentation/views/templating.md @@ -164,6 +164,8 @@ ## 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. + 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') diff --git a/laravel/form.php b/laravel/form.php index de2954b1..5fa6d129 100644 --- a/laravel/form.php +++ b/laravel/form.php @@ -427,7 +427,7 @@ protected static function optgroup($options, $label, $selected) $html[] = static::option($value, $display, $selected); } - return ''.implode('', $html).''; + return ''.implode('', $html).''; } /** diff --git a/laravel/input.php b/laravel/input.php index 6a28b17f..8d712871 100644 --- a/laravel/input.php +++ b/laravel/input.php @@ -287,4 +287,13 @@ public static function replace(array $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 diff --git a/laravel/request.php b/laravel/request.php index 510f64eb..84763449 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -102,7 +102,8 @@ public static function spoofed() */ 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; } /** diff --git a/laravel/session.php b/laravel/session.php index 00b4a356..877b5a45 100644 --- a/laravel/session.php +++ b/laravel/session.php @@ -1,4 +1,4 @@ -