Commit Graph

2004 Commits

Author SHA1 Message Date
Blaine Schmeisser
81a2f5b919 Pass the response by reference so it can be overwritten in filters
You can edit the response but you can't overwrite it:
~~~ php
<?php
// https://gist.github.com/3896743
$response = new stdClass();

echo '1): ' . spl_object_hash($response) . PHP_EOL; // 0000000021e89fcd00000000e93b17ba

call_user_func_array(function($response) {
	$response = new stdClass();
	echo '2): ' . spl_object_hash($response) . PHP_EOL; // 0000000021e89fcf00000000e93b17ba
}, array($response));

echo '3): ' . spl_object_hash($response) . PHP_EOL; // 0000000021e89fcd00000000e93b17ba

call_user_func_array(function($response) {
	$response = new stdClass();
	echo '4): ' . spl_object_hash($response) . PHP_EOL; // 0000000021e89fcf00000000e93b17ba // hash descoped and reused
}, array(&$response));

echo '5): ' . spl_object_hash($response) . PHP_EOL; // 0000000021e89fcf00000000e93b17ba
~~~

Otherwise you'd make the new response object and overwrite the values one at a time:
~~~ php
<?php
// https://gist.github.com/3897032
Route::filter('after', function($response)
{
	$params = \Laravel\Request::$route->parameters;
	// The 'type' is the last param
	// example: /product/(:num).(:any)
	$type = array_pop($params);
	if($type == 'json') {
		$res = Response::json($response->content->data);
		foreach($response as $key => &$value) {
			$response->$key = $res->$key;
		}
	}
});
~~~

Signed-off-by: Blaine Schmeisser <blaine.schmeisser@vitals.com>
2012-10-16 09:12:29 -05:00
helmut
ee18da9b73 Update laravel/file.php
Fixed bug that was causing the latest function to return the 'last' file rather than the actual 'latest' file.
2012-10-16 21:08:58 +12:00
crynobone
fd86aef25a Trivial improvement to Laravel, while it is not documented, it has been a standard in Laravel to use tab as indentation and new line for curly bracket
Signed-off-by: crynobone <crynobone@gmail.com>
2012-10-15 23:35:53 +08:00
everclear
9b63f65408 link_to_route requires 3 parameters if wildcard values are required 2012-10-15 15:50:10 +02:00
Vincent Talbot
6a14705a63 Merge pull request #8 from laravel/develop
Develop
2012-10-15 05:09:22 -07:00
matz3
97013cd816 Spelling mistake correction in documentation
Added missing 's' in the word 'is' (Laravel Overview).

Signed-off-by: matz3 <osswaldm94@gmail.com>
2012-10-14 18:48:25 +02:00
Franz Liedke
d7dfd4f915 Use DB::escape() shortcut in profiler. 2012-10-11 18:24:43 +03:00
Shawn McCool
2e8364994f changed date format in validation documentation to match ISO8601 2012-10-11 08:14:55 +02:00
Taylor Otwell
d55328cc52 Merge pull request #1320 from dejangeci/feature/dbexception-inner
Added a getInner method for retrieving the inner exception
2012-10-07 12:05:01 -07:00
Taylor Otwell
3416506194 increment version. refactor eloquent eager loading matching. 2012-10-07 14:04:29 -05:00
Taylor Otwell
1df8fa91fc Merge pull request #1322 from vFragosop/eloquent/relationship_performance
Fixing has_one iterations
2012-10-07 11:56:24 -07:00
Vinícius Fragoso
f6c7cf2dcd Fixing pivot on has_one aswell as properly indenting 2012-10-07 12:15:57 -03:00
Dejan Geci
165da94aee Added a getInner method for retrieving the inner exception
Signed-off-by: Dejan Geci <dejan.geci@gmail.com>
2012-10-07 13:55:32 +02:00
Taylor Otwell
790a540620 Merge pull request #1294 from danielboendergaard/phpdoc-fix
Fixed wrong return type in phpdoc
2012-10-06 12:39:23 -07:00
Taylor Otwell
7555fda589 Merge pull request #1307 from tillsanders/develop
Update laravel/helpers.php
2012-10-06 12:38:26 -07:00
Vinícius Fragoso
f36446bd10 Improving laravel relationship performance 2012-10-05 10:35:48 -03:00
Franz Liedke
1081ac1b8a Implement DB::escape(). 2012-10-05 14:38:13 +03:00
tillsanders
00d1baf69e Update laravel/helpers.php
The e-helper and the __-Helper used the core-classes. 
So if I would like to override them, the helpers would still use the core-classes.
See this thread for further explanation: http://forums.laravel.com/viewtopic.php?id=2656
2012-10-03 15:35:34 +03:00
Shawn McCool
f53f07df4a Update laravel/documentation/database/eloquent.md
minor grammar update in docs
2012-10-03 13:24:05 +03:00
Shawn McCool
00edb1db8c clarified table naming conventions 2012-10-03 12:19:11 +02:00
Nathan Malcolm
2d5cc12b7b Fixes XSS vulnerability in Profiler 2012-10-03 00:53:20 +01:00
Daniel Bøndergaard
54397e1bf2 Fixed wrong return type in phpdoc
Signed-off-by: Daniel Bøndergaard <db@helmstmt.com>
2012-09-28 10:10:35 +02:00
Taylor Otwell
d1c1fe4446 fix bug in eloquent model and update version. 2012-09-27 17:45:12 -04:00
Taylor Otwell
02cb96a008 fix bug in eloquent model. 2012-09-27 17:44:03 -04:00
Vincent Talbot
c55a8f49dd Update laravel/cli/tasks/migrate/migrator.php 2012-09-27 11:57:34 -03:00
Vincent Talbot
a5c5d70bd6 Merge pull request #5 from laravel/develop
Develop
2012-09-27 06:44:30 -07:00
Taylor Otwell
ae5331b312 Merge branch 'staging' 2012-09-27 09:08:20 -04:00
Taylor Otwell
4de8e2d717 Update change log. 2012-09-27 09:05:29 -04:00
Taylor Otwell
b043482905 Improve view errors. 2012-09-26 16:20:56 -04:00
Taylor Otwell
633c2bde83 Pass the path to the filter event. 2012-09-26 11:20:03 -04:00
Taylor Otwell
a976c555e6 Added "view.filter" event so we can hook in final filters. 2012-09-26 10:43:34 -04:00
Taylor Otwell
14c6ff1692 Increment version and change log. 2012-09-26 10:13:30 -04:00
Taylor Otwell
3e3ee870ea Merge branch 'develop' of github.com:laravel/laravel into develop 2012-09-26 10:11:46 -04:00
Taylor Otwell
d64d6c9092 Fix logging issue when using the laravel.log event. 2012-09-26 10:11:24 -04:00
Taylor Otwell
09500818e0 Merge pull request #1204 from bryantebeek/optimisation/str-class
Performance enhancement for Str Class (see pull request #1180)
2012-09-25 18:37:53 -07:00
Taylor Otwell
fc9b0e1636 Merge pull request #1201 from JoostK/fix-1
Fixed a problem with `Eloquent::get_dirty`
2012-09-25 18:37:09 -07:00
Taylor Otwell
4b7dc2e824 Merge pull request #1226 from akuzemchak/bug/language-routes
Fixes language URI routing issue
2012-09-25 18:34:40 -07:00
Taylor Otwell
439f9c8055 Merge pull request #1236 from kuroi/patch-1
Correct broken links in docs
2012-09-25 18:33:48 -07:00
Taylor Otwell
dad0bbc688 Merge pull request #1247 from dcelasun/patch-1
Fix a tiny typo
2012-09-25 18:33:14 -07:00
Taylor Otwell
9acf541653 Merge pull request #1255 from joual/develop
Auth token now nulled on logout
2012-09-25 18:32:36 -07:00
Taylor Otwell
5a1741e9d5 Merge pull request #1276 from rk/rk-issue-1261
[#1261] get_key now pulls from $original instead
2012-09-25 18:31:34 -07:00
Taylor Otwell
4eac00a009 Use hash_hmac on cookie hashes. 2012-09-25 16:43:58 -04:00
Taylor Otwell
04f22f086d Update change log. 2012-09-25 08:42:03 -05:00
Taylor Otwell
ad313198df working on cookie fingerprinting. 2012-09-25 08:40:48 -05:00
Jakobud
e67ddd86dd Added output from String documentation examples. 2012-09-24 14:02:50 -06:00
RK
f148f6211c Fixing the array_get misspelling. 2012-09-24 10:35:07 -04:00
RK
258169ea00 [#1261] get_key now pulls from $original instead
This is in reference to issue #1261, where Model->get_key() returns
the key from the $attributes instead of from the $original property.
This breaks the functionality of a model with a primary key that may
change, as the SQL generated will be something like:

UPDATE `model` SET `key` = 'new-key' WHERE `key` = 'new-key';

Which won't update the model in the database.
2012-09-24 09:58:20 -04:00
Mohammad Sadeghi
9d28938d55 . 2012-09-24 16:42:09 +03:30
Mohammad Sadeghi
7647c3fcba added 'u' flag for preg_match to match UTF-8 URIs. 2012-09-24 16:39:28 +03:30
Mohammad Sadeghi
9df9a5df04 segment pattern to match a single segment, also matches UTF-8 segments. 2012-09-24 16:15:11 +03:30