language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | laravel | framework | dbc4dbcac06bbfabcd44bd4c34d210a9fb302e5a.json | Update optimize configuration. | src/Illuminate/Foundation/Console/Optimize/config.php | @@ -55,6 +55,7 @@
$basePath.'/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Router.php',
$basePath.'/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Workbench/WorkbenchServiceProvider.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php', | true |
Other | laravel | framework | dbc4dbcac06bbfabcd44bd4c34d210a9fb302e5a.json | Update optimize configuration. | src/Illuminate/Routing/Router.php | @@ -232,10 +232,9 @@ public function controllers(array $controllers)
*
* @param string $uri
* @param string $controller
- * @param array $names
* @return \Illuminate\Routing\Route
*/
- public function controller($uri, $controller, $names = array())
+ public function controller($uri, $controller)
{
$me = $this;
| true |
Other | laravel | framework | c9878249b8fd4b8ee0c854bb1b267f5956f2e99c.json | Put domain in route output. Closes #1388. | src/Illuminate/Foundation/Console/RoutesCommand.php | @@ -97,6 +97,7 @@ protected function getRouteInformation($name, Route $route)
$action = $route->getAction() ?: 'Closure';
return array(
+ 'host' => $route->getHost(),
'uri' => $uri,
'name' => $this->getRouteName($name),
'action' => $action,
@@ -112,7 +113,7 @@ protected function getRouteInformation($name, Route $route)
*/
protected function displayRoutes(array $routes)
{
- $headers = array('URI', 'Name', 'Action', 'Before Filters', 'After Filters');
+ $headers = array('Domain', 'URI', 'Name', 'Action', 'Before Filters', 'After Filters');
$this->table->setHeaders($headers)->setRows($routes);
| false |
Other | laravel | framework | 5860d05be4e062a2d0525a7f4941c6b7310ce779.json | Send mail support in mail service provider. | src/Illuminate/Mail/MailServiceProvider.php | @@ -4,6 +4,7 @@
use Illuminate\Support\ServiceProvider;
use Swift_SmtpTransport as SmtpTransport;
use Swift_MailTransport as MailTransport;
+use Swift_SendmailTransport as SendmailTransport;
class MailServiceProvider extends ServiceProvider {
@@ -81,6 +82,9 @@ protected function registerSwiftTransport($config)
case 'smtp':
return $this->registerSmtpTransport($config);
+ case 'sendmail':
+ return $this->registerSendmailTransport($config);
+
case 'mail':
return $this->registerMailTransport($config);
@@ -125,6 +129,20 @@ protected function registerSmtpTransport($config)
});
}
+ /**
+ * Register the Sendmail Swift Transport instance.
+ *
+ * @param array $config
+ * @return void
+ */
+ protected function registerSendmailTransport($config)
+ {
+ $this->app['swift.transport'] = $this->app->share(function($app) use ($config)
+ {
+ return SendmailTransport::newInstance($config['sendmail']);
+ });
+ }
+
/**
* Register the Mail Swift Transport instance.
*
| false |
Other | laravel | framework | f6b3c2d56cbb71d5413e8b27226a380591adda85.json | Bind real paths into container. | src/Illuminate/Foundation/Application.php | @@ -156,11 +156,11 @@ public function redirectIfTrailingSlash()
*/
public function bindInstallPaths(array $paths)
{
- $this->instance('path', $paths['app']);
+ $this->instance('path', realpath($paths['app']));
foreach (array_except($paths, array('app')) as $key => $value)
{
- $this->instance("path.{$key}", $value);
+ $this->instance("path.{$key}", realpath($value));
}
}
| false |
Other | laravel | framework | ffcd5d8f6621c77dfb98f390452d5980bf329092.json | Use realpath when checking modification time. | src/Illuminate/Filesystem/Filesystem.php | @@ -166,7 +166,7 @@ public function size($path)
*/
public function lastModified($path)
{
- return filemtime($path);
+ return filemtime(realpath($path));
}
/** | false |
Other | laravel | framework | 6877cb78b5f7c66a714826b3ea09dadef09d4c93.json | Remove a "feature". | src/Illuminate/Database/Eloquent/Model.php | @@ -419,7 +419,7 @@ public function load($relations)
{
if (is_string($relations)) $relations = func_get_args();
- $query = $this->newQuery()->wi@th($relations);
+ $query = $this->newQuery()->with($relations);
$query->eagerLoadRelations(array($this));
} | false |
Other | laravel | framework | 9abeb4b99403a95c3a7c8e8a419dbba660849efb.json | Remove extra dash from reg-ex. | src/Illuminate/Validation/Validator.php | @@ -863,7 +863,7 @@ protected function validateAlphaNum($attribute, $value)
*/
protected function validateAlphaDash($attribute, $value)
{
- return preg_match('/^([-a-z0-9_-])+$/i', $value);
+ return preg_match('/^([a-z0-9_-])+$/i', $value);
}
/** | false |
Other | laravel | framework | bcf036f35ac78e469e9bf8c00d7dbf47bda972d1.json | Add findOrFail to Query Builder | src/Illuminate/Database/Eloquent/Builder.php | @@ -74,6 +74,20 @@ public function first($columns = array('*'))
return $this->take(1)->get($columns)->first();
}
+ /**
+ * Find a model by its primary key or throw an exception.
+ *
+ * @param mixed $id
+ * @param array $columns
+ * @return \Illuminate\Database\Eloquent\Model|Collection
+ */
+ public function findOrFail($id, $columns = array('*'))
+ {
+ if ( ! is_null($model = $this->find($id, $columns))) return $model;
+
+ throw new ModelNotFoundException;
+ }
+
/**
* Execute the query and get the first result or throw an exception.
* | false |
Other | laravel | framework | 35936d69b95e0294754ddcb0c657b8a2091c6ac8.json | Fix PHP 5.4 syntax in test. | tests/Routing/RoutingUrlGeneratorTest.php | @@ -123,7 +123,7 @@ public function testWellFormedUrlIsReturnedUnchanged()
public function testUrlGeneratorUsesCurrentSchemeIfNoneSpecified()
{
$router = new Router;
- $router->get('/', ['as' => 'home', function() {}]);
+ $router->get('/', array('as' => 'home', function() {}));
$request = Request::create('https://dayle.com');
$gen = new UrlGenerator($router->getRoutes(), $request);
| false |
Other | laravel | framework | 68b0dd4de809bc4cead1e872088849658060e6fd.json | Add parameter array to redirect test. | src/Illuminate/Foundation/Testing/TestCase.php | @@ -206,24 +206,26 @@ public function assertRedirectedTo($uri, $with = array())
* Assert whether the client was redirected to a given route.
*
* @param string $name
+ * @param array $parameters
* @param array $with
* @return void
*/
- public function assertRedirectedToRoute($name, $with = array())
+ public function assertRedirectedToRoute($name, $parameters = array(), $with = array())
{
- $this->assertRedirectedTo($this->app['url']->route($name), $with);
+ $this->assertRedirectedTo($this->app['url']->route($name, $parameters), $with);
}
/**
* Assert whether the client was redirected to a given action.
*
* @param string $name
+ * @param array $parameters
* @param array $with
* @return void
*/
- public function assertRedirectedToAction($name, $with = array())
+ public function assertRedirectedToAction($name, $parameters = array(), $with = array())
{
- $this->assertRedirectedTo($this->app['url']->action($name), $with);
+ $this->assertRedirectedTo($this->app['url']->action($name, $parameters), $with);
}
/** | false |
Other | laravel | framework | 1d8c79de4832114175150735792213532986f9a6.json | Fix pivot bug. | src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php | @@ -752,7 +752,9 @@ public function newExistingPivot(array $attributes = array())
*/
public function withPivot($columns)
{
- $this->pivotColumns = is_array($columns) ? $columns : func_get_args();
+ $columns = is_array($columns) ? $columns : func_get_args();
+
+ $this->pivotColumns = array_merge($this->pivotColumns, $columns);
return $this;
} | false |
Other | laravel | framework | f703cf23b120b5b5338f57b4841a565d69765ce3.json | Return new static instance instead of Collection | src/Illuminate/Support/Collection.php | @@ -251,7 +251,7 @@ public function values()
*/
public function fetch($key)
{
- return new Collection(array_fetch($this, $key));
+ return new static(array_fetch($this, $key));
}
/**
@@ -278,7 +278,7 @@ public function collapse()
$results = array_merge($results, $values);
}
- return new Collection($results);
+ return new static($results);
}
/**
@@ -300,7 +300,7 @@ public function merge($items)
$results = array_merge($this->items, $items);
- return new Collection($results);
+ return new static($results);
}
/**
| false |
Other | laravel | framework | 8cb69ce28b3b4ea6548c23cfef580296ec0f5e34.json | Fix broken test. | src/Illuminate/Http/Request.php | @@ -195,8 +195,6 @@ public function input($key = null, $default = null)
*/
public function only($keys)
{
- $results = array();
-
$keys = is_array($keys) ? $keys : func_get_args();
$input = $this->input(); | true |
Other | laravel | framework | 8cb69ce28b3b4ea6548c23cfef580296ec0f5e34.json | Fix broken test. | tests/Auth/AuthDatabaseReminderRepositoryTest.php | @@ -59,7 +59,7 @@ public function testExistReturnsTrueIfValidRecordExists()
$repo->getConnection()->shouldReceive('table')->once()->with('table')->andReturn($query = m::mock('StdClass'));
$query->shouldReceive('where')->once()->with('email', 'email')->andReturn($query);
$query->shouldReceive('where')->once()->with('token', 'token')->andReturn($query);
- $date = date('Y-m-d H:i:s', time() - 200000);
+ $date = date('Y-m-d H:i:s', time() - 600);
$query->shouldReceive('first')->andReturn((object) array('created_at' => $date));
$user = m::mock('Illuminate\Auth\Reminders\RemindableInterface');
$user->shouldReceive('getReminderEmail')->andReturn('email'); | true |
Other | laravel | framework | 109a51636aaa5194d93b46c2890978194cea6a04.json | Fix query string infinite redirect. Fixes #1309. | src/Illuminate/Http/Request.php | @@ -56,7 +56,9 @@ public function url()
*/
public function fullUrl()
{
- return rtrim($this->getUri(), '/');
+ $query = $this->getQueryString();
+
+ return $query ? $this->url().'?'.$query : $this->url();
}
/** | false |
Other | laravel | framework | 80f51e7e15082abeb34ff147fad8f87896754652.json | Replace foreach with in_array | src/Illuminate/Validation/Validator.php | @@ -827,15 +827,7 @@ protected function validateMimes($attribute, $value, $parameters)
// The Symfony File class should do a decent job of guessing the extension
// based on the true MIME type so we'll just loop through the array of
// extensions and compare it to the guessed extension of the files.
- foreach ($parameters as $extension)
- {
- if ($value->guessExtension() == $extension)
- {
- return true;
- }
- }
-
- return false;
+ return in_array($value->guessExtension(), $parameters);
}
/** | false |
Other | laravel | framework | 5889a048aa9b4f996377c5f1ce90a525c200b500.json | Fix boolean precendence problem. Closes #1302. | src/Illuminate/Exception/ExceptionServiceProvider.php | @@ -120,7 +120,7 @@ protected function registerWhoopsHandler()
*/
protected function shouldReturnJson()
{
- $definitely = $this->app['request']->ajax() or $this->app->runningInConsole();
+ $definitely = ($this->app['request']->ajax() or $this->app->runningInConsole());
return $definitely or $this->app['request']->wantsJson();
}
| false |
Other | laravel | framework | 6f690e84b35891c97d21d264fa5c308885007652.json | Pass connection name to query event. Closes #1300. | src/Illuminate/Database/Connection.php | @@ -506,7 +506,7 @@ public function logQuery($query, $bindings, $time = null)
{
if (isset($this->events))
{
- $this->events->fire('illuminate.query', array($query, $bindings, $time));
+ $this->events->fire('illuminate.query', array($query, $bindings, $time, $this->getName()));
}
if ( ! $this->loggingQueries) return; | true |
Other | laravel | framework | 6f690e84b35891c97d21d264fa5c308885007652.json | Pass connection name to query event. Closes #1300. | tests/Database/DatabaseConnectionTest.php | @@ -177,7 +177,7 @@ public function testLogQueryFiresEventsIfSet()
$connection = $this->getMockConnection();
$connection->logQuery('foo', array(), time());
$connection->setEventDispatcher($events = m::mock('Illuminate\Events\Dispatcher'));
- $events->shouldReceive('fire')->once()->with('illuminate.query', array('foo', array(), null));
+ $events->shouldReceive('fire')->once()->with('illuminate.query', array('foo', array(), null, null));
$connection->logQuery('foo', array(), null);
}
| true |
Other | laravel | framework | a49c220ff830248b87ae8b922b6996582890c92a.json | Fix bug with container binding instances. | src/Illuminate/Container/Container.php | @@ -63,6 +63,8 @@ public function bind($abstract, $concrete = null, $shared = false)
$this->alias($abstract, $alias);
}
+ unset($this->instances[$abstract]);
+
// If no concrete type was given, we will simply set the concrete type to
// the abstract. This allows concrete types to be registered as shared
// without being made state their classes in both of the parameters. | true |
Other | laravel | framework | a49c220ff830248b87ae8b922b6996582890c92a.json | Fix bug with container binding instances. | src/Illuminate/Foundation/Application.php | @@ -537,7 +537,7 @@ public function dispatch(Request $request)
*/
public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
- $this['request'] = $request;
+ $this->instance('request', $request);
Facade::clearResolvedInstance('request');
| true |
Other | laravel | framework | 475872269956f1217f180a976d27f0b79ec03cc4.json | Return 500 error on debug exceptions. | src/Illuminate/Exception/Handler.php | @@ -153,6 +153,10 @@ public function handleException($exception)
$response->send();
}
+
+ // If no response was sent by this custom exception handler, we will call the
+ // default exception displayer for the current application context and let
+ // it show the exception to the user / developer based on the situation.
else
{
$this->displayException($exception); | true |
Other | laravel | framework | 475872269956f1217f180a976d27f0b79ec03cc4.json | Return 500 error on debug exceptions. | src/Illuminate/Exception/WhoopsDisplayer.php | @@ -23,6 +23,8 @@ public function __construct(Run $whoops)
*/
public function display(Exception $exception)
{
+ header('HTTP/1.1 500 Internal Server Error');
+
$this->whoops->handleException($exception);
}
| true |
Other | laravel | framework | 72546bb59b55cf8edb0ddbdf49ac8537ae3e9f3c.json | Fix a typo in Artisan command description. | src/Illuminate/Foundation/Console/UpCommand.php | @@ -16,7 +16,7 @@ class UpCommand extends Command {
*
* @var string
*/
- protected $description = "Bring the application out of maintenace mode";
+ protected $description = "Bring the application out of maintenance mode";
/**
* Execute the console command. | false |
Other | laravel | framework | dab7f0d69acc261f4d263f9f088729e8e4b84754.json | Add some notes | readme.md | @@ -78,6 +78,7 @@
- Allow "dot" notation access into session arrays.
- Added `smallInteger` to query builder.
- Added `dd` and `array_pull` helpers.
+- Added `bigint` and `mediumint` on schema builder
## Beta 4
| false |
Other | laravel | framework | afec6c4becba0ce50d4a58aacb83b3b9b7c1a58b.json | Fix serials typo | src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php | @@ -24,7 +24,7 @@ class PostgresGrammar extends Grammar {
*
* @var array
*/
- protected $serial = array('bigInteger', 'integer');
+ protected $serials = array('bigInteger', 'integer');
/**
* Compile the query to determine if a table exists. | true |
Other | laravel | framework | afec6c4becba0ce50d4a58aacb83b3b9b7c1a58b.json | Fix serials typo | src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php | @@ -25,7 +25,7 @@ class SQLiteGrammar extends Grammar {
*
* @var array
*/
- protected $serial = array('bigInteger', 'integer');
+ protected $serials = array('bigInteger', 'integer');
/**
* Compile the query to determine if a table exists. | true |
Other | laravel | framework | afec6c4becba0ce50d4a58aacb83b3b9b7c1a58b.json | Fix serials typo | src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php | @@ -24,7 +24,7 @@ class SqlServerGrammar extends Grammar {
*
* @var array
*/
- protected $serial = array('bigInteger', 'integer');
+ protected $serials = array('bigInteger', 'integer');
/**
* Compile the query to determine if a table exists. | true |
Other | laravel | framework | d14e9e35185f469c039f8bb55f135b73318b57f9.json | Fix PHP 5.3 breakage. | src/Illuminate/Routing/Router.php | @@ -525,18 +525,14 @@ protected function addResourceDestroy($name, $base, $controller)
*/
public function getResourceUri($resource)
{
- if ( ! str_contains($resource, '.')) return $resource;
-
// To create the nested resource URI, we will simply explode the segments and
// create a base URI for each of them, then join all of them back together
// with slashes. This should create the properly nested resource routes.
- $nested = implode('/', array_map(function($segment)
- {
- $wildcard = $this->getResourceWildcard($segment);
+ if ( ! str_contains($resource, '.')) return $resource;
- return $segment.'/{'.$wildcard.'}';
+ $segments = explode('.', $resource);
- }, $segments = explode('.', $resource)));
+ $nested = $this->getNestedResourceUri($segments);
// Once we have built the base URI, we'll remove the wildcard holder for this
// base resource name so that the individual route adders can suffix these
@@ -546,6 +542,26 @@ public function getResourceUri($resource)
return str_replace('/{'.$last.'}', '', $nested);
}
+ /**
+ * Get the URI for a nested resource segment array.
+ *
+ * @param array $segments
+ * @return string
+ */
+ protected function getNestedResourceUri(array $segments)
+ {
+ $me = $this;
+
+ // We will spin through the segments and create a place-holder for each of the
+ // resource segments, as well as the resource itself. Then we should get an
+ // entire string for the resource URI that contains all nested resources.
+ return implode('/', array_map(function($s) use ($me)
+ {
+ return $s.'/{'.$this->getResourceWildcard($s).'}';
+
+ }, $segments));
+ }
+
/**
* Get the action array for a resource route.
*
@@ -615,7 +631,7 @@ protected function getBaseResource($resource)
* @param string $value
* @return string
*/
- protected function getResourceWildcard($value)
+ public function getResourceWildcard($value)
{
return str_replace('-', '_', $value);
} | false |
Other | laravel | framework | 568104a51d4696ea50c5ce3623b2653c1e6566b2.json | Fix timestamps in MySQL. | src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php | @@ -398,6 +398,8 @@ protected function typeTime(Fluent $column)
*/
protected function typeTimestamp(Fluent $column)
{
+ if ( ! $column->nullable) return 'timestamp default 0';
+
return 'timestamp';
}
| false |
Other | laravel | framework | d050a1b64004fb4f5db48cd046b0b0f932b6d5b6.json | Simplify Eloquent collections. | src/Illuminate/Database/Eloquent/Collection.php | @@ -4,13 +4,6 @@
class Collection extends BaseCollection {
- /**
- * A dictionary of available primary keys.
- *
- * @var array
- */
- protected $dictionary = array();
-
/**
* Find a model in the collection by key.
*
@@ -20,12 +13,11 @@ class Collection extends BaseCollection {
*/
public function find($key, $default = null)
{
- if (count($this->dictionary) == 0)
+ return array_first($this->items, function($key, $model) use ($key)
{
- $this->buildDictionary();
- }
+ return $model->getKey() == $key;
- return array_get($this->dictionary, $key, $default);
+ }, $default);
}
/**
@@ -54,22 +46,6 @@ public function add($item)
{
$this->items[] = $item;
- // If the dictionary is empty, we will re-build it upon adding the item so
- // we can quickly search it from the "contains" method. This dictionary
- // will give us faster look-up times while searching for given items.
- if (count($this->dictionary) == 0)
- {
- $this->buildDictionary();
- }
-
- // If this dictionary has already been initially hydrated, we just need to
- // add an entry for the added item, which we will do here so that we'll
- // be able to quickly determine it is in the array when asked for it.
- elseif ($item instanceof Model)
- {
- $this->dictionary[$item->getKey()] = true;
- }
-
return $this;
}
@@ -81,33 +57,7 @@ public function add($item)
*/
public function contains($key)
{
- if (count($this->dictionary) == 0)
- {
- $this->buildDictionary();
- }
-
- return isset($this->dictionary[$key]);
- }
-
- /**
- * Build the dictionary of primary keys.
- *
- * @return void
- */
- protected function buildDictionary()
- {
- $this->dictionary = array();
-
- // By building the dictionary of items by key, we are able to more quickly
- // access the array and examine it for certain items. This is useful on
- // the contain method which searches through the list by primary key.
- foreach ($this->items as $item)
- {
- if ($item instanceof Model)
- {
- $this->dictionary[$item->getKey()] = $item;
- }
- }
+ return ! is_null($this->find($key));
}
/**
@@ -117,9 +67,7 @@ protected function buildDictionary()
*/
public function modelKeys()
{
- if (count($this->dictionary) === 0) $this->buildDictionary();
-
- return array_keys($this->dictionary);
+ return array_map(function($m) { return $m->getKey(); }, $this->items);
}
} | false |
Other | laravel | framework | f47f8481ff8b485aede9db27fe09aa4e4a93a718.json | Remove Windows carriage return chars from Package | src/Illuminate/Workbench/Package.php | @@ -1,76 +1,76 @@
-<?php namespace Illuminate\Workbench;
-
-class Package {
-
- /**
- * The vendor name of the package.
- *
- * @var string
- */
- public $vendor;
-
- /**
- * The snake-cased version of the vendor.
- *
- * @var string
- */
- public $lowerVendor;
-
- /**
- * The name of the package.
- *
- * @var string
- */
- public $name;
-
- /**
- * The snake-cased version of the package.
- *
- * @var string
- */
- public $lowerName;
-
- /**
- * The name of the author.
- *
- * @var string
- */
- public $author;
-
- /**
- * The email address of the author.
- *
- * @var string
- */
- public $email;
-
- /**
- * Create a new package instance.
- *
- * @param string $vendor
- * @param string $name
- * @param string $author
- * @param string $email
- * @return void
- */
- public function __construct($vendor, $name, $author, $email)
- {
- $this->name = $name;
- $this->email = $email;
- $this->vendor = $vendor;
- $this->author = $author;
- $this->lowerName = snake_case($name, '-');
- $this->lowerVendor = snake_case($vendor, '-');
- }
-
- /**
- * Get the full package name.
- *
- * @return string
- */
- public function getFullName()
- {
- return $this->lowerVendor.'/'.$this->lowerName;
- }
-
+<?php namespace Illuminate\Workbench;
+
+class Package {
+
+ /**
+ * The vendor name of the package.
+ *
+ * @var string
+ */
+ public $vendor;
+
+ /**
+ * The snake-cased version of the vendor.
+ *
+ * @var string
+ */
+ public $lowerVendor;
+
+ /**
+ * The name of the package.
+ *
+ * @var string
+ */
+ public $name;
+
+ /**
+ * The snake-cased version of the package.
+ *
+ * @var string
+ */
+ public $lowerName;
+
+ /**
+ * The name of the author.
+ *
+ * @var string
+ */
+ public $author;
+
+ /**
+ * The email address of the author.
+ *
+ * @var string
+ */
+ public $email;
+
+ /**
+ * Create a new package instance.
+ *
+ * @param string $vendor
+ * @param string $name
+ * @param string $author
+ * @param string $email
+ * @return void
+ */
+ public function __construct($vendor, $name, $author, $email)
+ {
+ $this->name = $name;
+ $this->email = $email;
+ $this->vendor = $vendor;
+ $this->author = $author;
+ $this->lowerName = snake_case($name, '-');
+ $this->lowerVendor = snake_case($vendor, '-');
+ }
+
+ /**
+ * Get the full package name.
+ *
+ * @return string
+ */
+ public function getFullName()
+ {
+ return $this->lowerVendor.'/'.$this->lowerName;
+ }
+
} | false |
Other | laravel | framework | 03f4e92a55fbaf2968a8417c38be491a6f29b60d.json | Add "reverse" method to Collection. | src/Illuminate/Support/Collection.php | @@ -221,6 +221,18 @@ public function sortBy(Closure $callback)
return $this;
}
+ /**
+ * Reverse items order.
+ *
+ * @return \Illuminate\Support\Collection
+ */
+ public function reverse()
+ {
+ $this->items = array_reverse($this->items);
+
+ return $this;
+ }
+
/**
* Reset the keys on the underlying array.
*
| true |
Other | laravel | framework | 03f4e92a55fbaf2968a8417c38be491a6f29b60d.json | Add "reverse" method to Collection. | tests/Support/SupportCollectionTest.php | @@ -42,7 +42,7 @@ public function testEmptyCollectionIsEmpty()
$c = new Collection();
$this->assertTrue($c->isEmpty());
- }
+ }
public function testToArrayCallsToArrayOnEachItemInCollection()
@@ -144,7 +144,7 @@ public function testSort()
{
$data = new Collection(array(5, 3, 1, 2, 4));
$data->sort(function($a, $b)
- {
+ {
if ($a === $b)
{
return 0;
@@ -164,4 +164,13 @@ public function testSortBy()
$this->assertEquals(array('dayle', 'taylor'), array_values($data->all()));
}
+
+ public function testReverse()
+ {
+ $data = new Collection(array('zaeed', 'alan'));
+ $data->reverse();
+
+ $this->assertEquals(array('alan', 'zaeed'), array_values($data->all()));
+ }
+
}
| true |
Other | laravel | framework | 909e4d0e75deb95659deebde1bf7ec09563a88d6.json | Fix encryption pad handling. Fixes #1238. | src/Illuminate/Encryption/Encrypter.php | @@ -92,11 +92,11 @@ public function decrypt($payload)
// We'll go ahead and remove the PKCS7 padding from the encrypted value before
// we decrypt it. Once we have the de-padded value, we will grab the vector
// and decrypt the data, passing back the unserialized from of the value.
- $value = $this->stripPadding(base64_decode($payload['value']));
+ $value = base64_decode($payload['value']);
$iv = base64_decode($payload['iv']);
- return unserialize(rtrim($this->mcryptDecrypt($value, $iv)));
+ return unserialize($this->stripPadding($this->mcryptDecrypt($value, $iv)));
}
/**
@@ -171,7 +171,7 @@ protected function stripPadding($value)
{
$pad = ord($value[($len = strlen($value)) - 1]);
- return $this->paddingIsValid($pad, $value) ? substr($value, 0, -$pad) : $value;
+ return $this->paddingIsValid($pad, $value) ? substr($value, 0, strlen($value) - $pad) : $value;
}
/**
@@ -183,7 +183,9 @@ protected function stripPadding($value)
*/
protected function paddingIsValid($pad, $value)
{
- return $pad and $pad <= $this->block and preg_match('/'.chr($pad).'{'.$pad.'}$/', $value);
+ $beforePad = strlen($value) - $pad;
+
+ return substr($value, $beforePad) == str_repeat(substr($value, -1), $pad);
}
/** | false |
Other | laravel | framework | 7101e3d232b8198d2a8a601175caf5581bbd16b9.json | Fix method signature of inherited method. | src/Illuminate/Database/Schema/Grammars/Grammar.php | @@ -219,16 +219,13 @@ public function wrapTable($table)
}
/**
- * Wrap a value in keyword identifiers.
- *
- * @param string $value
- * @return string
+ * {@inheritdoc}
*/
- public function wrap($value)
+ public function wrap($value, $prefixAlias = false)
{
if ($value instanceof Fluent) $value = $value->name;
- return parent::wrap($value);
+ return parent::wrap($value, $prefixAlias);
}
/** | false |
Other | laravel | framework | 554713afb487666fb8d7400d2be6a7b7427ba5de.json | Implement failing tests for prefixing aliases. | tests/Database/DatabaseQueryBuilderTest.php | @@ -53,6 +53,24 @@ public function testBasicAlias()
}
+ public function testAliasWithPrefix()
+ {
+ $builder = $this->getBuilder();
+ $builder->getGrammar()->setTablePrefix('prefix_');
+ $builder->select('*')->from('users as people');
+ $this->assertEquals('select * from "prefix_users" as "prefix_people"', $builder->toSql());
+ }
+
+
+ public function testJoinAliasesWithPrefix()
+ {
+ $builder = $this->getBuilder();
+ $builder->getGrammar()->setTablePrefix('prefix_');
+ $builder->select('*')->from('services')->join('translations AS t', 't.item_id', '=', 'services.id');
+ $this->assertEquals('select * from "prefix_services" inner join "prefix_translations" as "prefix_t" on "prefix_t"."item_id" = "prefix_services"."id"', $builder->toSql());
+ }
+
+
public function testBasicTableWrapping()
{
$builder = $this->getBuilder(); | false |
Other | laravel | framework | 9919a6130448d9e9d2d8f97dda6e65abde8d0e3f.json | Add smallInteger to Blueprint. | src/Illuminate/Database/Schema/Blueprint.php | @@ -386,6 +386,17 @@ public function tinyInteger($column)
return $this->addColumn('tinyInteger', $column);
}
+ /**
+ * Create a new small integer column on the table.
+ *
+ * @param string $column
+ * @return \Illuminate\Support\Fluent
+ */
+ public function smallInteger($column)
+ {
+ return $this->addColumn('smallInteger', $column);
+ }
+
/**
* Create a new unsigned integer column on the table.
*
@@ -659,4 +670,4 @@ public function getCommands()
return $this->commands;
}
-}
\ No newline at end of file
+} | true |
Other | laravel | framework | 9919a6130448d9e9d2d8f97dda6e65abde8d0e3f.json | Add smallInteger to Blueprint. | src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php | @@ -302,6 +302,17 @@ protected function typeTinyInteger(Fluent $column)
return 'tinyint(1)';
}
+ /**
+ * Create the column definition for a small integer type.
+ *
+ * @param \Illuminate\Support\Fluent $column
+ * @return string
+ */
+ protected function typeSmallInteger(Fluent $column)
+ {
+ return 'smallint';
+ }
+
/**
* Create the column definition for a float type.
*
@@ -470,4 +481,4 @@ protected function modifyAfter(Blueprint $blueprint, Fluent $column)
}
}
-}
\ No newline at end of file
+} | true |
Other | laravel | framework | 9919a6130448d9e9d2d8f97dda6e65abde8d0e3f.json | Add smallInteger to Blueprint. | src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php | @@ -255,6 +255,17 @@ protected function typeTinyInteger(Fluent $column)
return 'smallint';
}
+ /**
+ * Create the column definition for a small integer type.
+ *
+ * @param \Illuminate\Support\Fluent $column
+ * @return string
+ */
+ protected function typeSmallInteger(Fluent $column)
+ {
+ return 'smallint';
+ }
+
/**
* Create the column definition for a float type.
*
@@ -396,4 +407,4 @@ protected function modifyIncrement(Blueprint $blueprint, Fluent $column)
}
}
-}
\ No newline at end of file
+} | true |
Other | laravel | framework | 9919a6130448d9e9d2d8f97dda6e65abde8d0e3f.json | Add smallInteger to Blueprint. | src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php | @@ -319,6 +319,17 @@ protected function typeTinyInteger(Fluent $column)
return 'integer';
}
+ /**
+ * Create the column definition for a small integer type.
+ *
+ * @param \Illuminate\Support\Fluent $column
+ * @return string
+ */
+ protected function typeSmallInteger(Fluent $column)
+ {
+ return 'integer';
+ }
+
/**
* Create the column definition for a float type.
* | true |
Other | laravel | framework | 9919a6130448d9e9d2d8f97dda6e65abde8d0e3f.json | Add smallInteger to Blueprint. | src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php | @@ -251,6 +251,17 @@ protected function typeTinyInteger(Fluent $column)
return 'tinyint';
}
+ /**
+ * Create the column definition for a small integer type.
+ *
+ * @param \Illuminate\Support\Fluent $column
+ * @return string
+ */
+ protected function typeSmallInteger(Fluent $column)
+ {
+ return 'smallint';
+ }
+
/**
* Create the column definition for a float type.
*
@@ -392,4 +403,4 @@ protected function modifyIncrement(Blueprint $blueprint, Fluent $column)
}
}
-}
\ No newline at end of file
+} | true |
Other | laravel | framework | 9919a6130448d9e9d2d8f97dda6e65abde8d0e3f.json | Add smallInteger to Blueprint. | tests/Database/DatabasePostgresSchemaGrammarTest.php | @@ -239,7 +239,7 @@ public function testAddingInteger()
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertEquals(1, count($statements));
- $this->assertEquals('alter table "users" add column "foo" serial primary key not null', $statements[0]);
+ $this->assertEquals('alter table "users" add column "foo" serial primary key not null', $statements[0]);
}
@@ -254,14 +254,25 @@ public function testAddingTinyInteger()
}
+ public function testAddingSmallInteger()
+ {
+ $blueprint = new Blueprint('users');
+ $blueprint->smallInteger('foo');
+ $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
+
+ $this->assertEquals(1, count($statements));
+ $this->assertEquals('alter table "users" add column "foo" smallint not null', $statements[0]);
+ }
+
+
public function testAddingFloat()
{
$blueprint = new Blueprint('users');
$blueprint->float('foo', 5, 2);
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertEquals(1, count($statements));
- $this->assertEquals('alter table "users" add column "foo" real not null', $statements[0]);
+ $this->assertEquals('alter table "users" add column "foo" real not null', $statements[0]);
}
@@ -375,4 +386,4 @@ public function getGrammar()
return new Illuminate\Database\Schema\Grammars\PostgresGrammar;
}
-}
\ No newline at end of file
+} | true |
Other | laravel | framework | 9919a6130448d9e9d2d8f97dda6e65abde8d0e3f.json | Add smallInteger to Blueprint. | tests/Database/DatabaseSQLiteSchemaGrammarTest.php | @@ -220,7 +220,7 @@ public function testAddingInteger()
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertEquals(1, count($statements));
- $this->assertEquals('alter table "users" add column "foo" integer null primary key autoincrement', $statements[0]);
+ $this->assertEquals('alter table "users" add column "foo" integer null primary key autoincrement', $statements[0]);
}
@@ -235,14 +235,25 @@ public function testAddingTinyInteger()
}
+ public function testAddingSmallInteger()
+ {
+ $blueprint = new Blueprint('users');
+ $blueprint->smallInteger('foo');
+ $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
+
+ $this->assertEquals(1, count($statements));
+ $this->assertEquals('alter table "users" add column "foo" integer null', $statements[0]);
+ }
+
+
public function testAddingFloat()
{
$blueprint = new Blueprint('users');
$blueprint->float('foo', 5, 2);
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertEquals(1, count($statements));
- $this->assertEquals('alter table "users" add column "foo" float null', $statements[0]);
+ $this->assertEquals('alter table "users" add column "foo" float null', $statements[0]);
}
@@ -360,4 +371,4 @@ public function getGrammar()
return new Illuminate\Database\Schema\Grammars\SQLiteGrammar;
}
-}
\ No newline at end of file
+} | true |
Other | laravel | framework | 9919a6130448d9e9d2d8f97dda6e65abde8d0e3f.json | Add smallInteger to Blueprint. | tests/Database/DatabaseSqlServerSchemaGrammarTest.php | @@ -228,7 +228,7 @@ public function testAddingInteger()
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertEquals(1, count($statements));
- $this->assertEquals('alter table "users" add "foo" int identity primary key not null', $statements[0]);
+ $this->assertEquals('alter table "users" add "foo" int identity primary key not null', $statements[0]);
}
@@ -243,14 +243,25 @@ public function testAddingTinyInteger()
}
+ public function testAddingSmallInteger()
+ {
+ $blueprint = new Blueprint('users');
+ $blueprint->smallInteger('foo');
+ $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
+
+ $this->assertEquals(1, count($statements));
+ $this->assertEquals('alter table "users" add "foo" smallint not null', $statements[0]);
+ }
+
+
public function testAddingFloat()
{
$blueprint = new Blueprint('users');
$blueprint->float('foo', 5, 2);
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertEquals(1, count($statements));
- $this->assertEquals('alter table "users" add "foo" float not null', $statements[0]);
+ $this->assertEquals('alter table "users" add "foo" float not null', $statements[0]);
}
@@ -364,4 +375,4 @@ public function getGrammar()
return new Illuminate\Database\Schema\Grammars\SqlServerGrammar;
}
-}
\ No newline at end of file
+} | true |
Other | laravel | framework | 9db66a6b4b7a08b635b0b2638b5e14859e6dafea.json | Use table helper from Symfony 2.3. | src/Illuminate/Foundation/Console/RoutesCommand.php | @@ -8,7 +8,7 @@
class RoutesCommand extends Command {
- /**
+ /**
* The console command name.
*
* @var string
@@ -105,79 +105,11 @@ protected function getRouteInformation($name, Route $route)
*/
protected function displayRoutes(array $routes)
{
- $widths = $this->getCellWidths($routes);
-
- $this->displayHeadings($widths);
-
- foreach($routes as $route)
- {
- $this->displayRoute($route, $widths);
- }
- }
-
- /**
- * Display the route table headings.
- *
- * @param array $widths
- * @return void
- */
- protected function displayHeadings(array $widths)
- {
- extract($widths);
-
- $this->comment(str_pad('URI', $uris).str_pad('Name', $names).str_pad('Action', $actions));
- }
-
- /**
- * Display a route in the route table.
- *
- * @param array $route
- * @param array $widths
- * @return void
- */
- protected function displayRoute(array $route, array $widths)
- {
- extract($widths);
-
- $this->info(
- str_pad($route['uri'], $uris).str_pad($route['name'], $names).str_pad($route['action'], $actions)
- );
- }
+ $table = $this->getHelperSet()->get('table');
- /**
- * Get the correct cell spacing per column.
- *
- * @param array $routes
- * @return array
- */
- protected function getCellWidths($routes, $padding = 10)
- {
- $widths = array();
-
- foreach($this->getColumns($routes) as $key => $column)
- {
- $widths[$key] = max(array_map('strlen', $column)) + $padding;
- }
-
- return $widths;
- }
-
- /**
- * Get the columns for the route table.
- *
- * @param array $routes
- * @return array
- */
- protected function getColumns(array $routes)
- {
- $columns = array();
-
- foreach (array('uris', 'actions', 'names') as $key)
- {
- $columns[$key] = array_pluck($routes, str_singular($key));
- }
+ $table->setHeaders(array('URI', 'Name', 'Action'))->setRows($routes);
- return $columns;
+ $table->render($this->getOutput());
}
/** | false |
Other | laravel | framework | f71da22b7114d5ae0ea270a385bdec088d5a5f8c.json | Fix Session::has with dot notation. | src/Illuminate/Session/Store.php | @@ -38,6 +38,14 @@ protected function ageFlashData()
$this->put('flash.new', array());
}
+ /**
+ * {@inheritdoc}
+ */
+ public function has($name)
+ {
+ return ! is_null($this->get($name));
+ }
+
/**
* {@inheritdoc}
*/ | false |
Other | laravel | framework | b6fdc831561d777b36c5904f84733b9b05ccff5e.json | Fix Travis CI build errors
Composer uses the GitHub API to download packages, but the API is
rate-limited so repeated builds from the same IP hit the limit. This
adds --prefer-source to download from source, which is slower but more
reliable. It also adds --no-interaction to avoid hanging in case a
similar issue should arise in the future.
Reference:
https://github.com/composer/composer/issues/1314 | .travis.yml | @@ -6,6 +6,6 @@ php:
before_script:
- curl -s http://getcomposer.org/installer | php
- - php composer.phar install --prefer-dist --dev
+ - php composer.phar install --prefer-source --no-interaction --dev
-script: phpunit
\ No newline at end of file
+script: phpunit | false |
Other | laravel | framework | eab3b57f32d6f1a7b836bf7b9fb3af87de86dfdf.json | Fix static bug in trashed. | src/Illuminate/Database/Eloquent/Model.php | @@ -1252,9 +1252,11 @@ public static function withTrashed()
*/
public static function trashed()
{
- $column = $this->getQualifiedDeletedAtColumn();
+ $instance = new static;
+
+ $column = $instance->getQualifiedDeletedAtColumn();
- return $this->newQueryWithDeleted()->whereNotNull($column);
+ return $instance->newQueryWithDeleted()->whereNotNull($column);
}
/** | false |
Other | laravel | framework | 415d36679d8077f6903db7e3faf2c16d131c96f1.json | Move getConfigLoader into application instance. | src/Illuminate/Foundation/Application.php | @@ -5,6 +5,7 @@
use Illuminate\Http\Response;
use Illuminate\Routing\Route;
use Illuminate\Routing\Router;
+use Illuminate\Config\FileLoader;
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Facade;
@@ -690,6 +691,16 @@ public function fatal(Closure $callback)
});
}
+ /**
+ * Get the configuration loader instance.
+ *
+ * @return \Illuminate\Config\LoaderInterface
+ */
+ public function getConfigLoader()
+ {
+ return new FileLoader(new Filesystem, $this['path'].'/config');
+ }
+
/**
* Set the current application locale.
* | true |
Other | laravel | framework | 415d36679d8077f6903db7e3faf2c16d131c96f1.json | Move getConfigLoader into application instance. | src/Illuminate/Foundation/start.php | @@ -30,7 +30,6 @@
*/
use Illuminate\Http\Request;
-use Illuminate\Config\FileLoader;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Facade;
use Illuminate\Foundation\AliasLoader;
@@ -94,23 +93,6 @@
Facade::setFacadeApplication($app);
-/*
-|--------------------------------------------------------------------------
-| Register The Configuration Loader
-|--------------------------------------------------------------------------
-|
-| The configuration loader is responsible for loading the configuration
-| options for the application. By default we'll use the "file" loader
-| but you are free to use any custom loaders with your application.
-|
-*/
-
-$app->bindIf('config.loader', function($app)
-{
- return new FileLoader(new Filesystem, $app['path'].'/config');
-
-}, true);
-
/*
|--------------------------------------------------------------------------
| Register The Configuration Repository
@@ -122,7 +104,7 @@
|
*/
-$config = new Config($app['config.loader'], $env);
+$config = new Config($app->getConfigLoader(), $env);
$app->instance('config', $config);
| true |
Other | laravel | framework | aa58b089b986904cfda8928a1de2da9a371768a0.json | Rename the merge method to collapse.
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com> | src/Illuminate/Support/Collection.php | @@ -255,11 +255,11 @@ public function flatten()
}
/**
- * Merge the collection itmes into a single array.
+ * Collapse the collection items into a single array.
*
* @return \Illuminate\Support\Collection
*/
- public function merge()
+ public function collapse()
{
$results = array();
| true |
Other | laravel | framework | aa58b089b986904cfda8928a1de2da9a371768a0.json | Rename the merge method to collapse.
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com> | tests/Support/SupportCollectionTest.php | @@ -133,10 +133,10 @@ public function testFlatten()
}
- public function testMerge()
+ public function testCollapse()
{
$data = new Collection(array(array($object1 = new StdClass), array($object2 = new StdClass)));
- $this->assertEquals(array($object1, $object2), $data->merge()->all());
+ $this->assertEquals(array($object1, $object2), $data->collapse()->all());
}
| true |
Other | laravel | framework | bd1d2e76ad20d43d7eaaa47394260ba1a7b66571.json | Switch merge order in View\Environment::make()
This ensures variables passed to @include() override the variables from the calling view | src/Illuminate/View/Environment.php | @@ -114,7 +114,7 @@ public function make($view, $data = array(), $mergeData = array())
{
$path = $this->finder->find($view);
- $data = array_merge($this->parseData($data), $mergeData);
+ $data = array_merge($mergeData, $this->parseData($data));
return new View($this, $this->getEngineFromPath($path), $view, $path, $data);
} | false |
Other | laravel | framework | fcad1d7b24af9878cfa3cf80e10adf0925a77ce4.json | Clear the resolved request facade on dispatch. | src/Illuminate/Foundation/Application.php | @@ -7,6 +7,7 @@
use Illuminate\Routing\Router;
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
+use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;
use Illuminate\Events\EventServiceProvider;
use Illuminate\Routing\RoutingServiceProvider;
@@ -528,6 +529,8 @@ public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MAS
{
$this['request'] = $request;
+ Facade::clearResolvedInstance('request');
+
return $this->dispatch($request);
}
| true |
Other | laravel | framework | fcad1d7b24af9878cfa3cf80e10adf0925a77ce4.json | Clear the resolved request facade on dispatch. | src/Illuminate/Support/Facades/Facade.php | @@ -115,6 +115,17 @@ protected static function resolveFacadeInstance($name)
return static::$resolvedInstance[$name] = static::$app[$name];
}
+ /**
+ * Clear a resolved facade instance.
+ *
+ * @param string $name
+ * @return void
+ */
+ public static function clearResolvedInstance($name)
+ {
+ unset(static::$resolvedInstance[$name]);
+ }
+
/**
* Clear all of the resolved instances.
* | true |
Other | laravel | framework | 36668bfbe3b7de25cd3d27587024057c9e49b056.json | Fix wildcard events. | src/Illuminate/Events/Dispatcher.php | @@ -18,6 +18,13 @@ class Dispatcher {
*/
protected $listeners = array();
+ /**
+ * The wildcard listeners.
+ *
+ * @var array
+ */
+ protected $wildcards = array();
+
/**
* The sorted event listeners.
*
@@ -66,10 +73,7 @@ public function listen($event, $listener, $priority = 0)
*/
protected function setupWildcardListen($event, $listener, $priority)
{
- foreach (array_keys($this->listeners) as $key)
- {
- if (str_is($event, $key)) $this->listen($key, $listener, $priority);
- }
+ $this->wildcards[$event][] = $listener;
}
/**
@@ -202,12 +206,32 @@ public function fire($event, $payload = array(), $halt = false)
*/
public function getListeners($eventName)
{
+ $wildcards = $this->getWildcardListeners($eventName);
+
if ( ! isset($this->sorted[$eventName]))
{
$this->sortListeners($eventName);
}
- return $this->sorted[$eventName];
+ return array_merge($this->sorted[$eventName], $wildcards);
+ }
+
+ /**
+ * Get the wildcard listeners for the event.
+ *
+ * @param string $eventName
+ * @return array
+ */
+ protected function getWildcardListeners($eventName)
+ {
+ $wildcards = array();
+
+ foreach ($this->wildcards as $key => $listeners)
+ {
+ if (str_is($key, $eventName)) $wildcards = array_merge($wildcards, $listeners);
+ }
+
+ return $wildcards;
}
/** | false |
Other | laravel | framework | 0911fa96d5f84c5b7fa68197a2a9d58c2dc0c6c1.json | Fix tests. Updated readme. | readme.md | @@ -66,6 +66,7 @@
- Added `replicate` method to Eloquent model.
- Added `slice` method to `Collection`.
- Fixed generation of namespaced resource controllers.
+- Send `user` to the password reminder e-mail view.
## Beta 4
| true |
Other | laravel | framework | 0911fa96d5f84c5b7fa68197a2a9d58c2dc0c6c1.json | Fix tests. Updated readme. | tests/Auth/AuthPasswordBrokerTest.php | @@ -64,11 +64,11 @@ public function testMailerIsCalledWithProperViewTokenAndCallback()
unset($_SERVER['__auth.reminder']);
$broker = $this->getBroker($mocks = $this->getMocks());
$callback = function($message, $user) { $_SERVER['__auth.reminder'] = true; };
- $mocks['mailer']->shouldReceive('send')->once()->with('reminderView', array('token' => 'token'), m::type('Closure'))->andReturnUsing(function($view, $data, $callback)
+ $user = m::mock('Illuminate\Auth\Reminders\RemindableInterface');
+ $mocks['mailer']->shouldReceive('send')->once()->with('reminderView', array('token' => 'token', 'user' => $user), m::type('Closure'))->andReturnUsing(function($view, $data, $callback)
{
return $callback;
});
- $user = m::mock('Illuminate\Auth\Reminders\RemindableInterface');
$user->shouldReceive('getReminderEmail')->once()->andReturn('email');
$message = m::mock('StdClass');
$message->shouldReceive('to')->once()->with('email'); | true |
Other | laravel | framework | 6881e798b5276134e8c278cff918070387b5085c.json | Fix bug in form builder. | src/Illuminate/Html/FormBuilder.php | @@ -727,9 +727,27 @@ public function getValueAttribute($name, $value = null)
if ( ! is_null($value)) return $value;
if (isset($this->model) and isset($this->model[$name]))
+ {
+ return $this->getModelValueAttribute($name);
+ }
+ }
+
+ /**
+ * Get the model value that should be assigned to the field.
+ *
+ * @param string $name
+ * @return string
+ */
+ protected function getModelValueAttribute($name)
+ {
+ if (is_object($this->model))
{
return object_get($this->model, $name);
}
+ elseif (is_array($this->model))
+ {
+ return array_get($this->model, $name);
+ }
}
/** | false |
Other | laravel | framework | b0e513c71ed123c604052884dc97eb60aa5aefc8.json | Allow $m->to, etc. to take an array of e-mails. | src/Illuminate/Mail/Message.php | @@ -68,15 +68,13 @@ public function returnPath($address)
/**
* Add a recipient to the message.
*
- * @param string $address
+ * @param string|array $address
* @param string $name
* @return \Illuminate\Mail\Message
*/
public function to($address, $name = null)
{
- $this->swift->addTo($address, $name);
-
- return $this;
+ return $this->addAddresses($address, $name, 'To');
}
/**
@@ -88,9 +86,7 @@ public function to($address, $name = null)
*/
public function cc($address, $name = null)
{
- $this->swift->addCc($address, $name);
-
- return $this;
+ return $this->addAddresses($address, $name, 'Cc');
}
/**
@@ -102,9 +98,7 @@ public function cc($address, $name = null)
*/
public function bcc($address, $name = null)
{
- $this->swift->addBcc($address, $name);
-
- return $this;
+ return $this->addAddresses($address, $name, 'Bcc');
}
/**
@@ -116,7 +110,26 @@ public function bcc($address, $name = null)
*/
public function replyTo($address, $name = null)
{
- $this->swift->addReplyTo($address, $name);
+ return $this->addAddresses($address, $name, 'ReplyTo');
+ }
+
+ /**
+ * Add a recipient to the message.
+ *
+ * @param string|array $address
+ * @param string $name
+ * @return \Illuminate\Mail\Message
+ */
+ protected function addAddresses($address, $name, $type)
+ {
+ if (is_array($address))
+ {
+ $this->swift->{"set{$type}"}($address, $name);
+ }
+ else
+ {
+ $this->swift->{"add{$type}"}($address, $name);
+ }
return $this;
} | false |
Other | laravel | framework | 30373c0685fdb06de8333cf8f19fa12e33094577.json | Refactor some code. | src/Illuminate/Database/Eloquent/Collection.php | @@ -117,10 +117,7 @@ protected function buildDictionary()
*/
public function modelKeys()
{
- if(count($this->dictionary) === 0)
- {
- $this->buildDictionary();
- }
+ if (count($this->dictionary) === 0) $this->buildDictionary();
return array_keys($this->dictionary);
} | false |
Other | laravel | framework | aa9d374c8451576356b792c193eceefc8d0a96fa.json | Fix session handling of booleans. | src/Illuminate/Session/Store.php | @@ -43,7 +43,9 @@ protected function ageFlashData()
*/
public function get($name, $default = null)
{
- return parent::get($name) ?: value($default);
+ $value = parent::get($name);
+
+ return is_null($value) ? value($default) : $value;
}
/** | false |
Other | laravel | framework | 291c64d0255d267a2dd62f6d760424a795a64bf5.json | Fix JSON responses. | src/Illuminate/Http/JsonResponse.php | @@ -0,0 +1,15 @@
+<?php namespace Illuminate\Http;
+
+class JsonResponse extends \Symfony\Component\HttpFoundation\JsonResponse {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setData($data = array())
+ {
+ $this->data = json_encode($data);
+
+ return $this->update();
+ }
+
+}
\ No newline at end of file | true |
Other | laravel | framework | 291c64d0255d267a2dd62f6d760424a795a64bf5.json | Fix JSON responses. | src/Illuminate/Support/Facades/Response.php | @@ -1,5 +1,6 @@
<?php namespace Illuminate\Support\Facades;
+use Illuminate\Http\JsonResponse;
use Illuminate\Support\Contracts\ArrayableInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
@@ -40,7 +41,7 @@ public static function view($view, $data = array(), $status = 200, array $header
* @param string|array $data
* @param int $status
* @param array $headers
- * @return Symfony\Component\HttpFoundation\JsonResponse
+ * @return Illuminate\Http\JsonResponse
*/
public static function json($data = array(), $status = 200, array $headers = array())
{
@@ -49,7 +50,7 @@ public static function json($data = array(), $status = 200, array $headers = arr
$data = $data->toArray();
}
- return static::make(json_encode($data), $status, $headers)->header('Content-Type', 'application/json');
+ return new JsonResponse($data, $status, $headers);
}
/** | true |
Other | laravel | framework | 17cd2bf854d98b1ac9b26321ec81d4a40d82f0d5.json | Fix translator choice replacements. | readme.md | @@ -116,6 +116,7 @@
- Session driver now automatically set to `array` when running Artisan tasks.
- Added static `unguard` method to Eloquent to disable all mass assignment protection.
- Added `--seed` option to `migrate` command.
+- Fix bug with replacements not being made on `Lang::choice`.
## Beta 3
| true |
Other | laravel | framework | 17cd2bf854d98b1ac9b26321ec81d4a40d82f0d5.json | Fix translator choice replacements. | src/Illuminate/Filesystem/Filesystem.php | @@ -180,8 +180,7 @@ public function isDirectory($directory)
}
/**
- * Determine if the given path is writable (the path can be either a
- * directory or a file).
+ * Determine if the given path is writable.
*
* @param string $path
* @return bool | true |
Other | laravel | framework | 17cd2bf854d98b1ac9b26321ec81d4a40d82f0d5.json | Fix translator choice replacements. | src/Illuminate/Translation/Translator.php | @@ -128,11 +128,11 @@ protected function makeReplacements($line, $replace)
*/
public function choice($key, $number, $replace = array(), $locale = null)
{
- $locale = $locale ?: $this->locale;
+ $line = $this->get($key, $replace, $locale = $locale ?: $this->locale);
- $line = $this->get($key, $replace, $locale);
+ array_unshift($replace, $number);
- return $this->getSelector()->choose($line, $number, $locale);
+ return $this->makeReplacements($this->getSelector()->choose($line, $number, $locale), $replace);
}
/** | true |
Other | laravel | framework | 1176cd8a6442e574cd9c6461cfe1f5df6bbe1c06.json | Fix bug in subscriber command. | src/Illuminate/Queue/Console/SubscribeCommand.php | @@ -69,7 +69,14 @@ protected function getPushType()
{
if ($this->option('type')) return $this->option('type');
- return $this->getQueue()->push_type;
+ try
+ {
+ return $this->getQueue()->push_type;
+ }
+ catch (\Exception $e)
+ {
+ return 'multicast';
+ }
}
/** | false |
Other | laravel | framework | 01cd39cb31a81b162f94bd290058eff6825dcf8d.json | Update whoops version. | composer.json | @@ -14,7 +14,7 @@
"classpreloader/classpreloader": "1.0.*",
"doctrine/dbal": "2.4.x",
"ircmaxell/password-compat": "1.0.*",
- "filp/whoops": "1.0.1",
+ "filp/whoops": "1.0.3",
"monolog/monolog": "1.4.*",
"nesbot/carbon": "1.*",
"patchwork/utf8": "1.1.*",
| false |
Other | laravel | framework | fc9760ad63e2421e484410394fd97e393fb21962.json | Set default encryption mode to "cbc". | readme.md | @@ -36,6 +36,7 @@
- Added `Html::mailto` and `Html::email` from Laravel 3.
- Added `Mail::queue`, `Mail::later`, `Mail::queueOn`, and `Mail::laterOn`. Screencast forthcoming.
- Added `URL::full` method as alias into `Request::fullUrl`.
+- Set default encryption mode to `cbc`. `Crypt::setMode` is available if you wish to use previous mode of `ctr`.
## Beta 4
| true |
Other | laravel | framework | fc9760ad63e2421e484410394fd97e393fb21962.json | Set default encryption mode to "cbc". | src/Illuminate/Encryption/Encrypter.php | @@ -23,7 +23,7 @@ class Encrypter {
*
* @var string
*/
- protected $mode = 'ctr';
+ protected $mode = 'cbc';
/**
* The block size of the cipher. | true |
Other | laravel | framework | a45157c26e26cdd191be9640f1e3f8fc44b78273.json | Change visibility of obfuscate method. | src/Illuminate/Html/HtmlBuilder.php | @@ -362,7 +362,7 @@ protected function attributeElement($key, $value)
* @param string $value
* @return string
*/
- protected function obfuscate($value)
+ public function obfuscate($value)
{
$safe = '';
| false |
Other | laravel | framework | 3bdcf541f2ffddd76ef076b07a809cd0cb4abae7.json | move close event out of the request lifecycle. | src/Illuminate/Routing/Router.php | @@ -1177,20 +1177,20 @@ public function findPatternFilters(Request $request)
protected function callAfterFilter(Request $request, SymfonyResponse $response)
{
$this->callGlobalFilter($request, 'after', array($response));
-
- $this->callGlobalFilter($request, 'close', array($response));
}
/**
- * Call the "finish" global filter.
+ * Call the "close" and "finish" global filters.
*
* @param Symfony\Component\HttpFoundation\Request $request
* @param Symfony\Component\HttpFoundation\Response $response
* @return mixed
*/
public function callFinishFilter(Request $request, SymfonyResponse $response)
{
- return $this->callGlobalFilter($request, 'finish', array($response));
+ $this->callGlobalFilter($request, 'close', array($response));
+
+ $this->callGlobalFilter($request, 'finish', array($response));
}
/** | true |
Other | laravel | framework | 3bdcf541f2ffddd76ef076b07a809cd0cb4abae7.json | move close event out of the request lifecycle. | tests/Routing/RoutingTest.php | @@ -223,18 +223,17 @@ public function testGlobalBeforeFiltersHaltRequestCycle()
}
- public function testAfterAndCloseFiltersAreCalled()
+ public function testAfterFiltersAreCalled()
{
$_SERVER['__routing.test'] = '';
$router = new Router;
$router->get('/foo', function() { return 'foo'; });
$router->before(function() { return null; });
$router->after(function() { $_SERVER['__routing.test'] = 'foo'; });
- $router->close(function() { $_SERVER['__routing.test'] .= 'bar'; });
$request = Request::create('/foo', 'GET');
$this->assertEquals('foo', $router->dispatch($request)->getContent());
- $this->assertEquals('foobar', $_SERVER['__routing.test']);
+ $this->assertEquals('foo', $_SERVER['__routing.test']);
unset($_SERVER['__routing.test']);
}
| true |
Other | laravel | framework | 32601943a1bf1e0348cd0718e5b9d3085e8cdda3.json | Check instances on bound method. | src/Illuminate/Container/Container.php | @@ -40,7 +40,7 @@ class Container implements ArrayAccess {
*/
public function bound($abstract)
{
- return isset($this[$abstract]);
+ return isset($this[$abstract]) or isset($this->instances[$abstract]);
}
/** | false |
Other | laravel | framework | bf8e0faecb13385cbb9fa0445d1ef3516a8a8345.json | Remove unneeded method. | src/Illuminate/Session/Store.php | @@ -46,17 +46,6 @@ public function get($name, $default = null)
return parent::get($name) ?: value($default);
}
- /**
- * Determine if the session has a flash item.
- *
- * @param string $name
- * @return bool
- */
- public function hasFlash($name)
- {
- return $this->has($name);
- }
-
/**
* Determine if the session contains old input.
* | false |
Other | laravel | framework | a761f383373db8863a4f5a93673ad8bd6cf60be7.json | Fix flash handling to be vastly simpler. | src/Illuminate/Session/FlashBag.php | @@ -1,203 +0,0 @@
-<?php namespace Illuminate\Session;
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * ADDITIONS (@taylorotwell): "peek" function now will return values from "display" and "new".
- */
-
-use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
-
-/**
- * AutoExpireFlashBag flash message container.
- *
- * @author Drak <drak@zikula.org>
- */
-class FlashBag implements FlashBagInterface
-{
- private $name = 'flashes';
-
- /**
- * Flash messages.
- *
- * @var array
- */
- private $flashes = array();
-
- /**
- * The storage key for flashes in the session
- *
- * @var string
- */
- private $storageKey;
-
- /**
- * Constructor.
- *
- * @param string $storageKey The key used to store flashes in the session.
- */
- public function __construct($storageKey = '_sf2_flashes')
- {
- $this->storageKey = $storageKey;
- $this->flashes = array('display' => array(), 'new' => array());
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->name;
- }
-
- public function setName($name)
- {
- $this->name = $name;
- }
-
- /**
- * {@inheritdoc}
- */
- public function initialize(array &$flashes)
- {
- $this->flashes = &$flashes;
-
- // The logic: messages from the last request will be stored in new, so we move them to previous
- // This request we will show what is in 'display'. What is placed into 'new' this time round will
- // be moved to display next time round.
- $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array();
- $this->flashes['new'] = array();
- }
-
- /**
- * {@inheritdoc}
- */
- public function add($type, $message)
- {
- $this->flashes['new'][$type][] = $message;
- }
-
- /**
- * {@inheritdoc}
- */
- public function peek($type, array $default = array())
- {
- $value = $this->has($type) ? $this->flashes['display'][$type] : $default;
-
- return $value ?: $this->peekNew($type, $default);
- }
-
- /**
- * Peek a "new" value from the flash bag.
- *
- * @param string $type
- * @param array $default
- * @return array
- */
- public function peekNew($type, array $default = array())
- {
- return $this->hasNew($type) ? $this->flashes['new'][$type] : $default;
- }
-
- /**
- * {@inheritdoc}
- */
- public function peekAll()
- {
- return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array();
- }
-
- /**
- * {@inheritdoc}
- */
- public function get($type, array $default = array())
- {
- $return = $default;
-
- if (!$this->has($type)) {
- return $return;
- }
-
- if (isset($this->flashes['display'][$type])) {
- $return = $this->flashes['display'][$type];
- unset($this->flashes['display'][$type]);
- }
-
- return $return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function all()
- {
- $return = array_merge($this->flashes['display'], $this->flashes['new']);
- $this->flashes = array('new' => array(), 'display' => array());
-
- return $return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setAll(array $messages)
- {
- $this->flashes['new'] = $messages;
- }
-
- /**
- * {@inheritdoc}
- */
- public function set($type, $messages)
- {
- $this->flashes['new'][$type] = is_object($messages) ? array($messages) : (array) $messages;
- }
-
- /**
- * {@inheritdoc}
- */
- public function has($type)
- {
- return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
- }
-
- /**
- * Determine if the flash has a "new" item.
- *
- * @param string $type
- * @return bool
- */
- public function hasNew($type)
- {
- return array_key_exists($type, $this->flashes['new']) && $this->flashes['new'][$type];
- }
-
- /**
- * {@inheritdoc}
- */
- public function keys()
- {
- return array_keys($this->flashes['display']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getStorageKey()
- {
- return $this->storageKey;
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- return $this->all();
- }
-} | true |
Other | laravel | framework | a761f383373db8863a4f5a93673ad8bd6cf60be7.json | Fix flash handling to be vastly simpler. | src/Illuminate/Session/SessionManager.php | @@ -27,7 +27,7 @@ protected function callCustomCreator($driver)
*/
protected function createArrayDriver()
{
- return new Store(new MockArraySessionStorage, null, new FlashBag);
+ return new Store(new MockArraySessionStorage);
}
/**
@@ -140,9 +140,7 @@ protected function createCacheBased($driver)
*/
protected function buildSession($handler)
{
- $storage = new NativeSessionStorage($this->getOptions(), $handler);
-
- return new Store($storage, null, new FlashBag);
+ return new Store(new NativeSessionStorage($this->getOptions(), $handler));
}
/**
| true |
Other | laravel | framework | a761f383373db8863a4f5a93673ad8bd6cf60be7.json | Fix flash handling to be vastly simpler. | src/Illuminate/Session/Store.php | @@ -17,44 +17,44 @@ public function start()
/**
* {@inheritdoc}
*/
- public function has($name)
+ public function save()
{
- return parent::has($name) or $this->hasFlash($name);
+ $this->ageFlashData();
+
+ return parent::save();
}
/**
- * {@inheritdoc}
+ * Age the flash data for the session.
+ *
+ * @return void
*/
- public function get($name, $default = null)
+ protected function ageFlashData()
{
- if ( ! is_null($value = parent::get($name))) return $value;
+ foreach ($this->get('flash.old', array()) as $old) { $this->forget($old); }
+
+ $this->put('flash.old', $this->get('flash.new'));
- return $this->getFlash($name, $default);
+ $this->put('flash.new', array());
}
/**
- * Determine if the session has a flash item.
- *
- * @param string $name
- * @return bool
+ * {@inheritdoc}
*/
- public function hasFlash($name)
+ public function get($name, $default = null)
{
- return ! is_null($this->getFlash($name));
+ return parent::get($name) ?: value($default);
}
/**
- * Get an item from the flashed session data.
+ * Determine if the session has a flash item.
*
* @param string $name
- * @param mixed $default
- * @return mixed
+ * @return bool
*/
- public function getFlash($name, $default = null)
+ public function hasFlash($name)
{
- $value = $this->getFlashBag()->peek($name);
-
- return count($value) > 0 ? $value[0] : value($default);
+ return $this->has($name);
}
/**
@@ -120,53 +120,44 @@ public function put($key, $value)
}
/**
- * Flash a key / value pair to the session.
+ * Push a value onto a session array.
*
* @param string $key
* @param mixed $value
* @return void
*/
- public function flash($key, $value)
+ public function push($key, $value)
{
- $this->getFlashBag()->set($key, $value);
- }
+ $array = $this->get($key, array());
- /**
- * Flash an input array to the session.
- *
- * @param array $value
- * @return void
- */
- public function flashInput(array $value)
- {
- return $this->flash('_old_input', $value);
+ $array[] = $value;
+
+ $this->put($key, $array);
}
/**
- * Keep all of the session flash data from expiring.
+ * Flash a key / value pair to the session.
*
+ * @param string $key
+ * @param mixed $value
* @return void
*/
- public function reflash()
+ public function flash($key, $value)
{
- foreach ($this->getFlashBag()->peekAll() as $key => $value)
- {
- $this->getFlashBag()->set($key, $value);
- }
+ $this->put($key, $value);
+
+ $this->push('flash.new', $key);
}
/**
- * Keep a session flash item from expiring.
+ * Flash an input array to the session.
*
- * @param string|array $keys
+ * @param array $value
* @return void
*/
- public function keep($keys)
+ public function flashInput(array $value)
{
- foreach (array_only($this->getFlashBag()->peekAll(), $keys) as $key => $value)
- {
- $this->getFlashBag()->set($key, $value);
- }
+ return $this->flash('_old_input', $value);
}
/** | true |
Other | laravel | framework | a761f383373db8863a4f5a93673ad8bd6cf60be7.json | Fix flash handling to be vastly simpler. | tests/Session/SessionStoreTest.php | @@ -1,35 +0,0 @@
-<?php
-
-use Mockery as m;
-
-class SessionStoreTest extends PHPUnit_Framework_TestCase {
-
- public function tearDown()
- {
- m::close();
- }
-
-
- public function testFlashBagReturnsItemsCorrectly()
- {
- $flash = new Illuminate\Session\FlashBag;
- $data = array('new' => array('name' => array('Taylor')), 'display' => array('foo' => array('bar')));
- $flash->initialize($data);
-
- $this->assertEquals(array('Taylor'), $flash->get('name'));
- }
-
-
- public function testPeekNewReturnsValuesFromNew()
- {
- $flash = new Illuminate\Session\FlashBag;
- $data = array('new' => array('name' => array('Taylor')), 'display' => array('foo' => array('bar')));
- $flash->initialize($data);
- $flash->set('age', 25);
-
- $this->assertEquals(array(25), $flash->peek('age'));
- $this->assertEquals(array(25), $flash->peekNew('age'));
- $this->assertTrue($flash->hasNew('age'));
- }
-
-}
\ No newline at end of file | true |
Other | laravel | framework | 9bcb92299e6abe1d34462189c0c98e3c9aa77d21.json | Fix old input. | src/Illuminate/Session/Store.php | @@ -65,7 +65,7 @@ public function hasOldInput($key)
*/
public function getOldInput($key = null, $default = null)
{
- $input = $this->getFlashBag()->peek('_old_input');
+ $input = $this->get('_old_input', array());
// Input that is flashed to the session can be easily retrieved by the
// developer, making repopulating old forms and the like much more | false |
Other | laravel | framework | 21cec23be8d22bd3ce608bb545d34edda02a0a89.json | Use table prefix in database sessions. | src/Illuminate/Session/SessionManager.php | @@ -49,11 +49,11 @@ protected function createNativeDriver()
*/
protected function createDatabaseDriver()
{
- $pdo = $this->getDatabaseConnection()->getPdo();
+ $connection = $this->getDatabaseConnection();
- $table = $this->app['config']['session.table'];
+ $table = $connection->getTablePrefix().$this->app['config']['session.table'];
- return $this->buildSession(new PdoSessionHandler($pdo, $this->getDatabaseOptions()));
+ return $this->buildSession(new PdoSessionHandler($connection->getPdo(), $this->getDatabaseOptions($table)));
}
/**
@@ -73,10 +73,8 @@ protected function getDatabaseConnection()
*
* @return array
*/
- protected function getDatabaseOptions()
+ protected function getDatabaseOptions($table)
{
- $table = $this->app['config']['session.table'];
-
return array('db_table' => $table, 'db_id_col' => 'id', 'db_data_col' => 'payload', 'db_time_col' => 'last_activity');
}
| false |
Other | laravel | framework | c1b3eedece74f70c97e098392fbc2007f5e2072c.json | Add new unit tests for dropColumn function
Signed-off-by: Dries Vints <dries.vints@gmail.com> | tests/Database/DatabaseMySqlSchemaGrammarTest.php | @@ -97,6 +97,13 @@ public function testDropColumn()
$this->assertEquals(1, count($statements));
$this->assertEquals('alter table `users` drop `foo`, drop `bar`', $statements[0]);
+
+ $blueprint = new Blueprint('users');
+ $blueprint->dropColumn('foo', 'bar');
+ $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
+
+ $this->assertEquals(1, count($statements));
+ $this->assertEquals('alter table `users` drop `foo`, drop `bar`', $statements[0]);
}
| true |
Other | laravel | framework | c1b3eedece74f70c97e098392fbc2007f5e2072c.json | Add new unit tests for dropColumn function
Signed-off-by: Dries Vints <dries.vints@gmail.com> | tests/Database/DatabasePostgresSchemaGrammarTest.php | @@ -69,6 +69,13 @@ public function testDropColumn()
$this->assertEquals(1, count($statements));
$this->assertEquals('alter table "users" drop column "foo", drop column "bar"', $statements[0]);
+
+ $blueprint = new Blueprint('users');
+ $blueprint->dropColumn('foo', 'bar');
+ $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
+
+ $this->assertEquals(1, count($statements));
+ $this->assertEquals('alter table "users" drop column "foo", drop column "bar"', $statements[0]);
}
| true |
Other | laravel | framework | c1b3eedece74f70c97e098392fbc2007f5e2072c.json | Add new unit tests for dropColumn function
Signed-off-by: Dries Vints <dries.vints@gmail.com> | tests/Database/DatabaseSqlServerSchemaGrammarTest.php | @@ -58,6 +58,13 @@ public function testDropColumn()
$this->assertEquals(1, count($statements));
$this->assertEquals('alter table "users" drop column "foo", "bar"', $statements[0]);
+
+ $blueprint = new Blueprint('users');
+ $blueprint->dropColumn('foo', 'bar');
+ $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
+
+ $this->assertEquals(1, count($statements));
+ $this->assertEquals('alter table "users" drop column "foo", "bar"', $statements[0]);
}
| true |
Other | laravel | framework | ff036c1bba9fc0391a0ba33a99d35e9a2793fef7.json | Remove duplicate function dropColumns
Since support for func_get_args was added to the dropColumn function, the dropColumns function is nothing more than a duplicate.
Signed-off-by: Dries Vints <dries.vints@gmail.com> | readme.md | @@ -26,6 +26,7 @@
- Migrated entire session back-end to Symfony HttpFoundation Session. The `native` driver should now be used in place of the `cookie` driver. All other drivers are available and work the same. New sessions will not be backwards compatible after updating.
- Renamed `Session::getToken` to `Session::token`.
- Added a few more helper methods to the `Collection` class.
+- Removed `dropColumns` function.
## Beta 4
| true |
Other | laravel | framework | ff036c1bba9fc0391a0ba33a99d35e9a2793fef7.json | Remove duplicate function dropColumns
Since support for func_get_args was added to the dropColumn function, the dropColumns function is nothing more than a duplicate.
Signed-off-by: Dries Vints <dries.vints@gmail.com> | src/Illuminate/Database/Schema/Blueprint.php | @@ -203,17 +203,6 @@ public function dropColumn($columns)
return $this->addCommand('dropColumn', compact('columns'));
}
- /**
- * Indicate that the given columns should be dropped.
- *
- * @param dynamic
- * @return \Illuminate\Support\Fluent
- */
- public function dropColumns()
- {
- return $this->dropColumn(func_get_args());
- }
-
/**
* Indicate that the given columns should be renamed.
*
@@ -277,7 +266,7 @@ public function dropForeign($index)
*/
public function dropTimestamps()
{
- $this->dropColumns('created_at', 'updated_at');
+ $this->dropColumn('created_at', 'updated_at');
}
/** | true |
Other | laravel | framework | ff036c1bba9fc0391a0ba33a99d35e9a2793fef7.json | Remove duplicate function dropColumns
Since support for func_get_args was added to the dropColumn function, the dropColumns function is nothing more than a duplicate.
Signed-off-by: Dries Vints <dries.vints@gmail.com> | tests/Database/DatabaseMySqlSchemaGrammarTest.php | @@ -100,17 +100,6 @@ public function testDropColumn()
}
- public function testDropColumns()
- {
- $blueprint = new Blueprint('users');
- $blueprint->dropColumns('foo', 'bar');
- $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
-
- $this->assertEquals(1, count($statements));
- $this->assertEquals('alter table `users` drop `foo`, drop `bar`', $statements[0]);
- }
-
-
public function testDropPrimary()
{
$blueprint = new Blueprint('users'); | true |
Other | laravel | framework | ff036c1bba9fc0391a0ba33a99d35e9a2793fef7.json | Remove duplicate function dropColumns
Since support for func_get_args was added to the dropColumn function, the dropColumns function is nothing more than a duplicate.
Signed-off-by: Dries Vints <dries.vints@gmail.com> | tests/Database/DatabasePostgresSchemaGrammarTest.php | @@ -72,17 +72,6 @@ public function testDropColumn()
}
- public function testDropColumns()
- {
- $blueprint = new Blueprint('users');
- $blueprint->dropColumns('foo', 'bar');
- $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
-
- $this->assertEquals(1, count($statements));
- $this->assertEquals('alter table "users" drop column "foo", drop column "bar"', $statements[0]);
- }
-
-
public function testDropPrimary()
{
$blueprint = new Blueprint('users'); | true |
Other | laravel | framework | ff036c1bba9fc0391a0ba33a99d35e9a2793fef7.json | Remove duplicate function dropColumns
Since support for func_get_args was added to the dropColumn function, the dropColumns function is nothing more than a duplicate.
Signed-off-by: Dries Vints <dries.vints@gmail.com> | tests/Database/DatabaseSqlServerSchemaGrammarTest.php | @@ -61,17 +61,6 @@ public function testDropColumn()
}
- public function testDropColumns()
- {
- $blueprint = new Blueprint('users');
- $blueprint->dropColumns('foo', 'bar');
- $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
-
- $this->assertEquals(1, count($statements));
- $this->assertEquals('alter table "users" drop column "foo", "bar"', $statements[0]);
- }
-
-
public function testDropPrimary()
{
$blueprint = new Blueprint('users'); | true |
Other | laravel | framework | b622dc2182b246a4a3c1f4e65bff686e655ce46c.json | Update compiled classes. | src/Illuminate/Foundation/Console/Optimize/config.php | @@ -18,6 +18,7 @@
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php',
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php',
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php',
+ $basePath.'/vendor/laravel/framework/src/Illuminate/Session/FlashBag.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Exception/ExceptionServiceProvider.php',
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php', | false |
Other | laravel | framework | 6f10c59bca9bf87f776c4ea1f1b8e3444c0e7f01.json | Fix bug with flash bag. Thanks Symfony. | src/Illuminate/Session/FlashBag.php | @@ -0,0 +1,15 @@
+<?php namespace Illuminate\Session;
+
+use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
+
+class FlashBag extends AutoExpireFlashBag {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set($type, $messages)
+ {
+ $this->flashes['new'][$type] = array($messages);
+ }
+
+}
\ No newline at end of file | true |
Other | laravel | framework | 6f10c59bca9bf87f776c4ea1f1b8e3444c0e7f01.json | Fix bug with flash bag. Thanks Symfony. | src/Illuminate/Session/SessionManager.php | @@ -1,7 +1,6 @@
<?php namespace Illuminate\Session;
use Illuminate\Support\Manager;
-use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
@@ -144,7 +143,7 @@ protected function buildSession($handler)
{
$storage = new NativeSessionStorage($this->getOptions(), $handler);
- return new Store($storage, null, new AutoExpireFlashBag);
+ return new Store($storage, null, new FlashBag);
}
/**
| true |
Other | laravel | framework | 469f85234468aa923da0fcc9814a22d07b9b6b33.json | Fix bug in session store. | src/Illuminate/Session/Store.php | @@ -29,11 +29,12 @@ public function get($name, $default = null)
/**
* Determine if the session contains old input.
*
+ * @param string $key
* @return bool
*/
- public function hasOldInput()
+ public function hasOldInput($key)
{
- return ! is_null($this->getOldInput());
+ return ! is_null($this->getOldInput($key));
}
/** | false |
Other | laravel | framework | f135399a5a2c013897aa0df54540d9d9954c7e45.json | Change visibility on engine. | src/Illuminate/Database/Schema/Blueprint.php | @@ -33,7 +33,7 @@ class Blueprint {
*
* @var string
*/
- protected $engine;
+ public $engine;
/**
* Create a new schema blueprint. | false |
Other | laravel | framework | d43d866448c3b360e21f575182fd305470c62918.json | Add support for engines to blueprint. | src/Illuminate/Database/Schema/Blueprint.php | @@ -28,6 +28,13 @@ class Blueprint {
*/
protected $commands = array();
+ /**
+ * The storage engine that should be used for the table.
+ *
+ * @var string
+ */
+ protected $engine;
+
/**
* Create a new schema blueprint.
* | true |
Other | laravel | framework | d43d866448c3b360e21f575182fd305470c62918.json | Add support for engines to blueprint. | src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php | @@ -44,7 +44,17 @@ public function compileCreate(Blueprint $blueprint, Fluent $command, Connection
$sql = 'create table '.$this->wrapTable($blueprint)." ($columns)";
- return $this->compileCreateEncoding($sql, $connection);
+ // Once we have the primary SQL, we can add the encoding option to the SQL for
+ // the table. Then, we can check if a storage engine has been supplied for
+ // the table. If so, we will add the engine declaration to the SQL query.
+ $sql = $this->compileCreateEncoding($sql, $connection);
+
+ if (isset($blueprint->engine))
+ {
+ $sql .= ' engine = '.$blueprint->engine;
+ }
+
+ return $sql;
}
/** | true |
Other | laravel | framework | a214aa724e41cf72425c8e282a23debff3a2f71d.json | Change dependency from Command to Fluent
Artisan was giving errors on running migrations for renaming DB columns. An incorrect Command dependency was the reason behind the bug. Changed it to the correct Fluent dependency.
Signed-off-by: Dries Vints <dries.vints@gmail.com> | src/Illuminate/Database/Schema/Grammars/Grammar.php | @@ -54,7 +54,7 @@ protected function getRenamedDiff(Blueprint $blueprint, Fluent $command, Column
* @param \Doctrine\DBAL\Schema\Column $column
* @return \Doctrine\DBAL\Schema\TableDiff
*/
- protected function setRenamedColumns(TableDiff $tableDiff, Command $command, Column $column)
+ protected function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column)
{
$newColumn = new Column($command->to, $column->getType(), $column->toArray());
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.