From db351fedf05776480435ebef635dc43716aa5e56 Mon Sep 17 00:00:00 2001 From: Samuel Fitz Date: Tue, 5 Jun 2012 13:31:21 -0600 Subject: [PATCH 01/24] added dblib option to sqlsrv connector class /sam fitz (abigwonderful) simple conditional added to look for dsn type. if set and is dblib, syntax for PDO connection adjusted slightly to allow for mac connection to mssql server (utilizing freetds) --- laravel/database/connectors/sqlserver.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/laravel/database/connectors/sqlserver.php b/laravel/database/connectors/sqlserver.php index 29c6929b..04d9d770 100644 --- a/laravel/database/connectors/sqlserver.php +++ b/laravel/database/connectors/sqlserver.php @@ -28,8 +28,16 @@ public function connect($config) // also be used to connect to Azure SQL Server databases. The port is defined // directly after the server name, so we'll create that first. $port = (isset($port)) ? ','.$port : ''; - - $dsn = "sqlsrv:Server={$host}{$port};Database={$database}"; + + //check for dblib for mac users connecting to mssql (utilizes freetds) + if (!empty($dsn_type) and $dsn_type == 'dblib') + { + $dsn = "dblib:host={$host}{$port};dbname={$database}"; + } + else + { + $dsn = "sqlsrv:Server={$host}{$port};Database={$database}"; + } return new PDO($dsn, $username, $password, $this->options($config)); } From e9e8a5b32e78bf2f7b589c181030ec7d3ef6a417 Mon Sep 17 00:00:00 2001 From: Jason Walton Date: Wed, 13 Jun 2012 10:22:27 -0700 Subject: [PATCH 02/24] Adds limit_exact method which will limit a string and its custom ending to a specified length Signed-off-by: Jason Walton --- laravel/documentation/strings.md | 1 + laravel/str.php | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/laravel/documentation/strings.md b/laravel/documentation/strings.md index 002d9148..4164e5ec 100644 --- a/laravel/documentation/strings.md +++ b/laravel/documentation/strings.md @@ -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: diff --git a/laravel/str.php b/laravel/str.php index 964b5d5b..23f2b731 100644 --- a/laravel/str.php +++ b/laravel/str.php @@ -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 + * + * + * // 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, '---'); + * + * + * @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. * From 19a3e9dc2b42de476aade6a75d8b457d4a93a425 Mon Sep 17 00:00:00 2001 From: anaxamaxan Date: Wed, 13 Jun 2012 16:23:28 -0700 Subject: [PATCH 03/24] Allow Model instance an id for first argument in Has_Many_And_Belongs_To::attach() and same for ::detach(). Also a typo fix for the docblock on attach(). --- .../relationships/has_many_and_belongs_to.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php index 587e504c..cc921861 100644 --- a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php +++ b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php @@ -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(); } From 9572329c499a2181339769d1d58ec33cc6a35e1c Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Mon, 25 Jun 2012 02:36:20 +0300 Subject: [PATCH 04/24] Allow Auth::login() to work with objects for the Eloquent driver. --- laravel/auth/drivers/eloquent.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/laravel/auth/drivers/eloquent.php b/laravel/auth/drivers/eloquent.php index 8c1c6a80..f90066be 100644 --- a/laravel/auth/drivers/eloquent.php +++ b/laravel/auth/drivers/eloquent.php @@ -7,15 +7,21 @@ 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) { + // 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($id, FILTER_VALIDATE_INT) !== false) { return $this->model()->find($id); } + else if (get_class($id) == Config::get('auth.model')) + { + return $id; + } } /** From 0f5de55d5b4d2fb15049bf2ca208c2d3d7b56730 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Mon, 25 Jun 2012 14:53:15 +0300 Subject: [PATCH 05/24] Fix variable name in retrieve() method for Eloquent auth driver. --- laravel/auth/drivers/eloquent.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/laravel/auth/drivers/eloquent.php b/laravel/auth/drivers/eloquent.php index f90066be..e50a3142 100644 --- a/laravel/auth/drivers/eloquent.php +++ b/laravel/auth/drivers/eloquent.php @@ -14,13 +14,13 @@ public function retrieve($token) { // 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($id, FILTER_VALIDATE_INT) !== false) + if (filter_var($token, FILTER_VALIDATE_INT) !== false) { - return $this->model()->find($id); + return $this->model()->find($token); } - else if (get_class($id) == Config::get('auth.model')) + else if (get_class($token) == Config::get('auth.model')) { - return $id; + return $token; } } From 433318181b92a493b4012f54b9b1f2c027e9062f Mon Sep 17 00:00:00 2001 From: Jakobud Date: Thu, 26 Jul 2012 16:00:46 -0600 Subject: [PATCH 06/24] In the call() method, the exception wasn't being thrown if only 1 or more than 2 arguments were passed to the method. Fixed conditional statement to only accept exactly 2 arguments. In the route() method, URI::current() was evaluating as '/' in all situations. It was never evaluating as the route that you specified when executing the command. This could be part of a larger underlying bug with Symfony's HttpFoundation\Request class. It might be a band-aid fix, but replacing URI::current() with $_SERVER['REQUEST_URI'] allows the method to run the correct route. These fixes uncovered what I believe is potentially another bug. When var_dump($route->response()) is run, "NULL" and a newline is appended to the output. It's something to do with var_dump(), as echo $route->response() echo's the correct output without the extra "NULL". Signed-off-by: Jakobud --- laravel/cli/tasks/route.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/laravel/cli/tasks/route.php b/laravel/cli/tasks/route.php index 494d5ba0..b30d467c 100644 --- a/laravel/cli/tasks/route.php +++ b/laravel/cli/tasks/route.php @@ -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)) { @@ -53,4 +53,4 @@ protected function route() } } -} \ No newline at end of file +} From f408fcc26b20e31308bf9f90617ade33c1596102 Mon Sep 17 00:00:00 2001 From: Jason Lewis Date: Fri, 27 Jul 2012 12:30:41 +0930 Subject: [PATCH 07/24] Allow bundles to respond to root requests. Signed-off-by: Jason Lewis --- laravel/bundle.php | 2 +- laravel/routing/router.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/laravel/bundle.php b/laravel/bundle.php index 2259228e..2220322b 100644 --- a/laravel/bundle.php +++ b/laravel/bundle.php @@ -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; } diff --git a/laravel/routing/router.php b/laravel/routing/router.php index 00659a22..cae6ff30 100644 --- a/laravel/routing/router.php +++ b/laravel/routing/router.php @@ -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 From 761186a67641ee047d33107760481703095f48c6 Mon Sep 17 00:00:00 2001 From: Jakobud Date: Tue, 31 Jul 2012 12:00:47 -0600 Subject: [PATCH 08/24] Reorganized Control Structure section. Added Control Structure to TOC. Added in missing @elseif example. Move the Blade Comments to more appropriate section. Simplified Blade Comments examples. Minor changes to @parent example. Signed-off-by: Jakobud --- laravel/documentation/views/templating.md | 89 ++++++++++++++--------- 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/laravel/documentation/views/templating.md b/laravel/documentation/views/templating.md index f4098c63..9aabac87 100644 --- a/laravel/documentation/views/templating.md +++ b/laravel/documentation/views/templating.md @@ -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) @@ -63,7 +64,7 @@ ## Blade Template Engine #### Echoing a variable using Blade: - Hello, {{$name}}. + Hello, {{ $name }}. #### Echoing function results using Blade: @@ -80,15 +81,46 @@ #### Render a view: @render('admin.list') -#### Creating loops using Blade: +#### Blade comments: -

Comments

+ {{-- This is a comment --}} + + {{-- + This is a + multi-line + comment. + --}} + +> **Note:** Unlike HTML comments, Blade comments are not visible in the HTML source. + + +## 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}}. + 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 - -#### The "unless" control structure: +#### Unless Statement: @unless(Auth::check()) - {{ HTML::link_to_route('login', 'Login'); }} + Login @endunless - // Equivalent... + // Equivalent to... - ... + Login - -#### 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. - ## 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. From 228f57226b5b6533ae0424e5c9bc60591855a997 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 3 Aug 2012 18:09:37 +0300 Subject: [PATCH 09/24] Extract sweep method in Session payload class. This allows for manually triggering garbage collection in session drivers. --- laravel/session/payload.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/laravel/session/payload.php b/laravel/session/payload.php index 1149951f..48aedd94 100644 --- a/laravel/session/payload.php +++ b/laravel/session/payload.php @@ -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)); } } From 31c730c9138fc4ead3b1644dbafc416e9ea77d9a Mon Sep 17 00:00:00 2001 From: Jakobud Date: Fri, 3 Aug 2012 10:47:34 -0600 Subject: [PATCH 10/24] Passing a null $value to Form::submit(), Form::reset() or Form::button() was throwing an Exception. I made the default $value = null for those methods. They result in the following respective valid HTML: Signed-off-by: Jakobud --- laravel/form.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/laravel/form.php b/laravel/form.php index 5fa6d129..e7855a1d 100644 --- a/laravel/form.php +++ b/laravel/form.php @@ -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 ''.HTML::entities($value).''; } From d31f89d42f716b08b3fd3369d7b5d53aefcaca2d Mon Sep 17 00:00:00 2001 From: Joe Wallace Date: Thu, 9 Aug 2012 22:10:49 -0500 Subject: [PATCH 11/24] Fixing a bug with saving data to pivot table --- laravel/database/eloquent/pivot.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/laravel/database/eloquent/pivot.php b/laravel/database/eloquent/pivot.php index d2878bb5..a90d7e7d 100644 --- a/laravel/database/eloquent/pivot.php +++ b/laravel/database/eloquent/pivot.php @@ -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; - } - } \ No newline at end of file From e3a000af4100a0f8614dc75cd08e7de06c041b0f Mon Sep 17 00:00:00 2001 From: Kelly Banman Date: Sat, 11 Aug 2012 15:52:58 -0700 Subject: [PATCH 12/24] Fix Query::lists() for empty resultsets --- laravel/database/query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/database/query.php b/laravel/database/query.php index c77ad65b..82a827e3 100644 --- a/laravel/database/query.php +++ b/laravel/database/query.php @@ -605,7 +605,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) { From 41e3c95ed6d190a709184779eeb16b2246e0ddd1 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Mon, 13 Aug 2012 19:03:59 +0300 Subject: [PATCH 13/24] Add German translations for new array validator. --- application/language/de/validation.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/language/de/validation.php b/application/language/de/validation.php index 80c3874e..170cc261 100644 --- a/application/language/de/validation.php +++ b/application/language/de/validation.php @@ -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.", From 973551cd8d65b16ea88e09150b18885294ff44fa Mon Sep 17 00:00:00 2001 From: Hirohisa Kawase Date: Sat, 18 Aug 2012 19:46:23 +0900 Subject: [PATCH 14/24] Change some Markdown to fit other md files' format. Signed-off-by: Hirohisa Kawase --- laravel/documentation/contrib/command-line.md | 47 ++++++------- laravel/documentation/contrib/github.md | 6 +- laravel/documentation/contrib/tortoisegit.md | 69 ++++++++++--------- 3 files changed, 62 insertions(+), 60 deletions(-) diff --git a/laravel/documentation/contrib/command-line.md b/laravel/documentation/contrib/command-line.md index d662e806..5dea4cb6 100644 --- a/laravel/documentation/contrib/command-line.md +++ b/laravel/documentation/contrib/command-line.md @@ -1,28 +1,29 @@ # Contributing to Laravel via Command-Line ## 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) - +- [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) + + ## 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. - + ## 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*). - + ## 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. - + ## 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. - + ## 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. - + ## 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. - + ## 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,19 +100,19 @@ ## Pushing to your Fork Your branch has been successfully pushed to your fork on GitHub. - + ## 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: - - **base repo:** laravel/laravel - - **base branch:** develop - - **head repo:** username/laravel - - **head branch:** feature/localization-docs +- **base repo:** laravel/laravel +- **base branch:** develop +- **head repo:** username/laravel +- **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. - + ## 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: diff --git a/laravel/documentation/contrib/github.md b/laravel/documentation/contrib/github.md index 5d9f43e9..5a136d72 100644 --- a/laravel/documentation/contrib/github.md +++ b/laravel/documentation/contrib/github.md @@ -6,19 +6,19 @@ ## Contents - [Repositories](#repositoriess) - [Branches](#branches) - + ## The Basics Because Laravel's development and source control is done through GitHub, anyone is able to make contributions to it. Anyone can fix bugs, add features or improve the documentation. After submitting proposed changes to the project, the Laravel team will review the changes and make the decision to commit them to Laravel's core. - + ## Repositories Laravel's home on GitHub is at [github.com/laravel](https://github.com/laravel). Laravel has several repositories. For basic contributions, the only repository you need to pay attention to is the **laravel** repository, located at [github.com/laravel/laravel](https://github.com/laravel/laravel). - + ## Branches The **laravel** repository has multiple branches, each serving a specific purpose: diff --git a/laravel/documentation/contrib/tortoisegit.md b/laravel/documentation/contrib/tortoisegit.md index aa79e8cb..74049ead 100644 --- a/laravel/documentation/contrib/tortoisegit.md +++ b/laravel/documentation/contrib/tortoisegit.md @@ -1,47 +1,48 @@ # Contributing to Laravel using TortoiseGit ## 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) - +- [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) + + ## 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. - + ## 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*). - + ## Cloning 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...** - - Git clone +- Right-click the Laravel directory to bring up the context menu. Click on **Git Clone...** +- Git clone - **Url:** https://github.com/laravel/laravel.git - **Directory:** the directory that you just created in the previous step - 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. - + ## Adding your Fork 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** - - Goto the **Git/Remote** section. Add a new remote: +- Right-click the Laravel directory and goto **TortoiseGit > Settings** +- Goto the **Git/Remote** section. Add a new remote: - **Remote**: fork - **URL**: https://github.com/username/laravel.git - Click **Add New/Save** @@ -49,12 +50,12 @@ ## Adding your Fork Remember to replace *username* with your GitHub username. *This is case-sensitive*. - + ## 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. - - Right-click the Laravel directory and goto **TortoiseGit > Create Branch** +- Right-click the Laravel directory and goto **TortoiseGit > Create Branch** - **Branch:** feature/localization-docs - **Base On Branch:** remotes/origin/develop - **Check** *Track* @@ -67,47 +68,47 @@ ## 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. - + ##Committing 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"...** - - Commit +- Right-click the Laravel directory and goto **Git Commit -> "feature/localization-docs"...** +- Commit - **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 - **Changes made:** Check all changed/added files - Click **OK** - + ## 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: - Right-click the Laravel directory and goto **Git Sync...** - Git Syncronization - - **Local Branch:** feature/localization-docs - - **Remote Branch:** leave this blank - - **Remote URL:** fork - - Click **Push** - - When asked for "username:" enter your GitHub *case-sensitive* username - - When asked for "password:" enter your GitHub *case-sensitive* account + - **Local Branch:** feature/localization-docs + - **Remote Branch:** leave this blank + - **Remote URL:** fork + - Click **Push** + - When asked for "username:" enter your GitHub *case-sensitive* username + - When asked for "password:" enter your GitHub *case-sensitive* account Your branch has been successfully pushed to your fork on GitHub. - + ## 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: - - **base repo:** laravel/laravel - - **base branch:** develop - - **head repo:** username/laravel - - **head branch:** feature/localization-docs +- **base repo:** laravel/laravel +- **base branch:** develop +- **head repo:** username/laravel +- **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. - + ## 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. From aca179cb953914b4a4e1d2df2240314f903ab3b3 Mon Sep 17 00:00:00 2001 From: Hirohisa Kawase Date: Sat, 18 Aug 2012 21:57:54 +0900 Subject: [PATCH 15/24] Deleted an anchor of top of line. Defined "config", but it was reffered from no where. So, keep code simple. Signed-off-by:Hirohisa Kawase --- laravel/documentation/session/config.md | 1 - 1 file changed, 1 deletion(-) diff --git a/laravel/documentation/session/config.md b/laravel/documentation/session/config.md index 094148c8..14821320 100644 --- a/laravel/documentation/session/config.md +++ b/laravel/documentation/session/config.md @@ -1,4 +1,3 @@ - # Session Configuration ## Contents From 63fe95dadc3880839a139e0dc50ba749ae01d640 Mon Sep 17 00:00:00 2001 From: Callum McIntyre Date: Sun, 19 Aug 2012 14:50:05 +0100 Subject: [PATCH 16/24] Changed timestamp function in database/eloquent/model.php from protected to public. Allows eloquent model timestamps to be updated without actually changing any data. git push fork minor/unprotect-eloquent-timestamps git status git # Signed-off-by: Callum McIntyre --- laravel/database/eloquent/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 61a7769c..d3d70fbb 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -445,7 +445,7 @@ public function delete() * * @return void */ - protected function timestamp() + public function timestamp() { $this->updated_at = new \DateTime; From f8fdcd894a1498025c0dca94485c11489cf6d51e Mon Sep 17 00:00:00 2001 From: Callum McIntyre Date: Sun, 19 Aug 2012 14:50:05 +0100 Subject: [PATCH 17/24] Changed timestamp function in eloquent/model.php to public --- laravel/database/eloquent/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 61a7769c..d3d70fbb 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -445,7 +445,7 @@ public function delete() * * @return void */ - protected function timestamp() + public function timestamp() { $this->updated_at = new \DateTime; From aa341357ece9eb65ffef75f890656e9a2db50592 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sun, 26 Aug 2012 01:10:31 +0300 Subject: [PATCH 18/24] Fix insert() method for related models. --- .../eloquent/relationships/has_one_or_many.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/laravel/database/eloquent/relationships/has_one_or_many.php b/laravel/database/eloquent/relationships/has_one_or_many.php index a8268de6..7dd453b3 100644 --- a/laravel/database/eloquent/relationships/has_one_or_many.php +++ b/laravel/database/eloquent/relationships/has_one_or_many.php @@ -12,11 +12,18 @@ class Has_One_Or_Many extends Relationship { */ 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(); + } + 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); + } } /** From e46f07d4365222b04fd654cada7a1940fc2ec4fd Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Mon, 27 Aug 2012 13:46:32 +0300 Subject: [PATCH 19/24] Fix method signature and return values of insert() method. --- laravel/database/eloquent/relationships/has_one_or_many.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/laravel/database/eloquent/relationships/has_one_or_many.php b/laravel/database/eloquent/relationships/has_one_or_many.php index 7dd453b3..e7bfc0b0 100644 --- a/laravel/database/eloquent/relationships/has_one_or_many.php +++ b/laravel/database/eloquent/relationships/has_one_or_many.php @@ -7,8 +7,10 @@ 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) { @@ -16,7 +18,7 @@ public function insert($attributes) { $attributes->set_attribute($this->foreign_key(), $this->base->get_key()); - return $attributes->save(); + return $attributes->save() ? $attributes : false; } else { From e11d13ae3154925c77a42c65a822da22d7d81f95 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Mon, 27 Aug 2012 15:09:11 +0200 Subject: [PATCH 20/24] Get rid of duplicate code for DROP TABLE in schema grammars. --- laravel/database/schema/grammars/grammar.php | 12 ++++++++++++ laravel/database/schema/grammars/mysql.php | 12 ------------ laravel/database/schema/grammars/postgres.php | 12 ------------ laravel/database/schema/grammars/sqlite.php | 12 ------------ laravel/database/schema/grammars/sqlserver.php | 12 ------------ 5 files changed, 12 insertions(+), 48 deletions(-) diff --git a/laravel/database/schema/grammars/grammar.php b/laravel/database/schema/grammars/grammar.php index 62a55719..1fea9a31 100644 --- a/laravel/database/schema/grammars/grammar.php +++ b/laravel/database/schema/grammars/grammar.php @@ -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. * diff --git a/laravel/database/schema/grammars/mysql.php b/laravel/database/schema/grammars/mysql.php index e8c926fe..f2727fc4 100644 --- a/laravel/database/schema/grammars/mysql.php +++ b/laravel/database/schema/grammars/mysql.php @@ -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. * diff --git a/laravel/database/schema/grammars/postgres.php b/laravel/database/schema/grammars/postgres.php index 4d014b1c..2b8620cc 100644 --- a/laravel/database/schema/grammars/postgres.php +++ b/laravel/database/schema/grammars/postgres.php @@ -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. * diff --git a/laravel/database/schema/grammars/sqlite.php b/laravel/database/schema/grammars/sqlite.php index 4eae9151..975c4137 100644 --- a/laravel/database/schema/grammars/sqlite.php +++ b/laravel/database/schema/grammars/sqlite.php @@ -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. * diff --git a/laravel/database/schema/grammars/sqlserver.php b/laravel/database/schema/grammars/sqlserver.php index 1a556367..3e1854c1 100644 --- a/laravel/database/schema/grammars/sqlserver.php +++ b/laravel/database/schema/grammars/sqlserver.php @@ -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. * From f34063c5175cef6909825a74cacded3b9398db91 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 29 Aug 2012 14:44:16 -0500 Subject: [PATCH 21/24] Fix bug in Eloquent to_array method. --- laravel/database/eloquent/model.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 61a7769c..4ee26264 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -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(); From c785067e95e5fd9c97934e01b3ca9a70bf7cf009 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 29 Aug 2012 14:45:22 -0500 Subject: [PATCH 22/24] Increment version and change log. --- artisan | 2 +- laravel/documentation/changes.md | 12 ++++++++++++ paths.php | 2 +- public/index.php | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/artisan b/artisan index 6212745f..6c9af056 100644 --- a/artisan +++ b/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 * @link http://laravel.com */ diff --git a/laravel/documentation/changes.md b/laravel/documentation/changes.md index 71d0c661..c23c410c 100644 --- a/laravel/documentation/changes.md +++ b/laravel/documentation/changes.md @@ -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,16 @@ ## Contents - [Laravel 3.1](#3.1) - [Upgrading From 3.0](#upgrade-3.1) + +## Laravel 3.2.7 + +- Fix bug in Eloquent `to_array` method. + + +### Upgrading From 3.2.6 + +- Replace the **laravel** folder. + ## Laravel 3.2.6 diff --git a/paths.php b/paths.php index 9fdd9f90..7bbd033e 100644 --- a/paths.php +++ b/paths.php @@ -3,7 +3,7 @@ * Laravel - A PHP Framework For Web Artisans * * @package Laravel - * @version 3.2.6 + * @version 3.2.7 * @author Taylor Otwell * @link http://laravel.com */ diff --git a/public/index.php b/public/index.php index ec6b0cca..6eeb7aa0 100644 --- a/public/index.php +++ b/public/index.php @@ -3,7 +3,7 @@ * Laravel - A PHP Framework For Web Artisans * * @package Laravel - * @version 3.2.6 + * @version 3.2.7 * @author Taylor Otwell * @link http://laravel.com */ From 2e01c58f92761ac24f9feb759d6f46c539984668 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 1 Sep 2012 21:48:37 -0500 Subject: [PATCH 23/24] Fix error handling. --- laravel/error.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/error.php b/laravel/error.php index ac2e4d15..6b75d210 100644 --- a/laravel/error.php +++ b/laravel/error.php @@ -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); From cfe5fa109a1b0073b2859154168c90658c859c24 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 1 Sep 2012 21:50:14 -0500 Subject: [PATCH 24/24] Add fix to change log. --- laravel/documentation/changes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/laravel/documentation/changes.md b/laravel/documentation/changes.md index c23c410c..dffb45ad 100644 --- a/laravel/documentation/changes.md +++ b/laravel/documentation/changes.md @@ -43,6 +43,7 @@ ## Contents ## Laravel 3.2.7 - Fix bug in Eloquent `to_array` method. +- Fix bug in displaying of generic error page. ### Upgrading From 3.2.6