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 | 63a534a31129be4cec4f5a694342d7020e2d7f07.json | Allow redirectPath for consistency. | src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php | @@ -107,6 +107,11 @@ public function getLogout()
*/
public function redirectPath()
{
+ if (property_exists($this, 'redirectPath'))
+ {
+ return $this->redirectPath;
+ }
+
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
}
| false |
Other | laravel | framework | fef793a9ab03a0e7d867fa68939e4055c321af38.json | change indent style
change indent style from 4 spaces to tabs | src/Illuminate/Routing/Router.php | @@ -503,10 +503,10 @@ protected function getGroupResourceName($prefix, $resource, $method)
{
$group = str_replace('/', '.', $this->getLastGroupPrefix());
- if (empty($group))
- {
- return trim("{$prefix}{$resource}.{$method}", '.');
- }
+ if (empty($group))
+ {
+ return trim("{$prefix}{$resource}.{$method}", '.');
+ }
return trim("{$prefix}{$group}.{$resource}.{$method}", '.');
} | false |
Other | laravel | framework | bfeaa370a77b9c853adae6faba4143ad683c0172.json | Add basePath() method to application contract. | src/Illuminate/Contracts/Foundation/Application.php | @@ -10,6 +10,13 @@ interface Application extends Container {
* @return string
*/
public function version();
+
+ /**
+ * Get the base path of the Laravel installation.
+ *
+ * @return string
+ */
+ public function basePath()
/**
* Get or check the current application environment. | false |
Other | laravel | framework | 44c61252b5762ff53ad181ed416e3006c50a6a9b.json | Remove optimize call. | src/Illuminate/Foundation/Console/AppNameCommand.php | @@ -83,10 +83,8 @@ public function fire()
$this->info('Application namespace set!');
$this->composer->dumpAutoloads();
-
- $this->call('clear-compiled');
- $this->call('optimize');
+ $this->call('clear-compiled');
}
/** | false |
Other | laravel | framework | b0ab0a29a416358a15d1872b5252666a35ca6046.json | Add support for terminating callbacks. | src/Illuminate/Foundation/Application.php | @@ -57,6 +57,13 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*/
protected $bootedCallbacks = array();
+ /**
+ * The array of terminating callbacks.
+ *
+ * @var array
+ */
+ protected $terminatingCallbacks = array();
+
/**
* All of the registered service providers.
*
@@ -752,6 +759,32 @@ public function abort($code, $message = '', array $headers = array())
throw new HttpException($code, $message, null, $headers);
}
+ /**
+ * Register a terminating callback with the application.
+ *
+ * @param \Closure $callback
+ * @return $this
+ */
+ public function terminating(Closure $callback)
+ {
+ $this->terminatingCallbacks[] = $callback;
+
+ return $this;
+ }
+
+ /**
+ * Terminate the application.
+ *
+ * @return void
+ */
+ public function terminate()
+ {
+ foreach ($this->terminatingCallbacks as $terminating)
+ {
+ $this->call($terminating);
+ }
+ }
+
/**
* Get the service providers that have been loaded.
* | true |
Other | laravel | framework | b0ab0a29a416358a15d1872b5252666a35ca6046.json | Add support for terminating callbacks. | src/Illuminate/Foundation/Console/Kernel.php | @@ -100,6 +100,18 @@ public function handle($input, $output = null)
}
}
+ /**
+ * Terminate the application.
+ *
+ * @param \Symfony\Component\Console\Input\InputInterface $input
+ * @param int $status
+ * @return void
+ */
+ public function terminate($input, $status)
+ {
+ $this->app->terminate();
+ }
+
/**
* Define the application's command schedule.
* | true |
Other | laravel | framework | b0ab0a29a416358a15d1872b5252666a35ca6046.json | Add support for terminating callbacks. | src/Illuminate/Foundation/Http/Kernel.php | @@ -126,6 +126,8 @@ public function terminate($request, $response)
$instance->terminate($request, $response);
}
}
+
+ $this->app->terminate();
}
/** | true |
Other | laravel | framework | e968f3362a0f5c43c6ceb576508e0fed3aa6f21c.json | Remove explicit middleware implements | src/Illuminate/Session/Middleware/StartSession.php | @@ -9,9 +9,8 @@
use Illuminate\Session\CookieSessionHandler;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Contracts\Routing\TerminableMiddleware;
-use Illuminate\Contracts\Routing\Middleware as MiddlewareContract;
-class StartSession implements MiddlewareContract, TerminableMiddleware {
+class StartSession implements TerminableMiddleware {
/**
* The session manager. | false |
Other | laravel | framework | 52fd8b764fa699bfce412d89f8e5aea30e4fdcc8.json | Add test for collection keyby closure | tests/Support/SupportCollectionTest.php | @@ -485,8 +485,12 @@ public function testGroupByAttribute()
public function testKeyByAttribute()
{
$data = new Collection([['rating' => 1, 'name' => '1'], ['rating' => 2, 'name' => '2'], ['rating' => 3, 'name' => '3']]);
+
$result = $data->keyBy('rating');
$this->assertEquals([1 => ['rating' => 1, 'name' => '1'], 2 => ['rating' => 2, 'name' => '2'], 3 => ['rating' => 3, 'name' => '3']], $result->all());
+
+ $result = $data->keyBy(function($item){ return $item['rating'] * 2; });
+ $this->assertEquals([2 => ['rating' => 1, 'name' => '1'], 4 => ['rating' => 2, 'name' => '2'], 6 => ['rating' => 3, 'name' => '3']], $result->all());
}
| false |
Other | laravel | framework | d4b6cea0ae1a67e48425c427d48b71f5d078cb90.json | Recreate compiled things in "app:name" command | src/Illuminate/Foundation/Console/AppNameCommand.php | @@ -83,6 +83,10 @@ public function fire()
$this->info('Application namespace set!');
$this->composer->dumpAutoloads();
+
+ $this->call('clear-compiled');
+
+ $this->call('optimize');
}
/** | false |
Other | laravel | framework | 579b13084213b67de205f015d5153c8e960cd615.json | Add message when no paths found | src/Illuminate/Foundation/Console/VendorPublishCommand.php | @@ -56,6 +56,12 @@ public function fire()
$this->option('provider'), $this->option('tag')
);
+ if (empty($paths))
+ {
+ $this->error("There are no paths to publish");
+ return;
+ }
+
foreach ($paths as $from => $to)
{
if ($this->files->isFile($from)) | false |
Other | laravel | framework | 494b959c9ca42e76e110a705e6ed31af78fffafd.json | Fix php artisan app:name crash | src/Illuminate/Foundation/Console/AppNameCommand.php | @@ -111,13 +111,11 @@ protected function replaceNamespace($path)
{
$search = [
'namespace '.$this->currentRoot.';',
- 'namespace '.$this->currentRoot.'\\',
$this->currentRoot.'\\',
];
$replace = [
'namespace '.$this->argument('name').';',
- 'namespace '.$this->argument('name').'\\',
$this->argument('name').'\\',
];
| false |
Other | laravel | framework | e699adda562706a0322cf5d7194d9da19bd6b972.json | boot the php web server from the public dir
Signed-off-by: Suhayb Wardany <me@suw.me> | src/Illuminate/Foundation/Console/ServeCommand.php | @@ -26,17 +26,17 @@ class ServeCommand extends Command {
*/
public function fire()
{
- chdir($this->laravel->basePath());
+ chdir($this->laravel->publicPath());
$host = $this->input->getOption('host');
$port = $this->input->getOption('port');
- $public = $this->laravel->publicPath();
+ $base = $this->laravel->basePath();
$this->info("Laravel development server started on http://{$host}:{$port}");
- passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} -t \"{$public}\" server.php");
+ passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} \"{$base}\"/server.php");
}
/** | false |
Other | laravel | framework | 8a19d18ff80338f64bf01a32d0297b9bd97344a8.json | Sync it up with master branch. | src/Illuminate/Foundation/Console/KeyGenerateCommand.php | @@ -34,14 +34,13 @@ public function fire()
return $this->line('<comment>'.$key.'</comment>');
}
- foreach ([base_path('.env'), base_path('.env.example')] as $path)
+ $path = base_path('.env');
+
+ if (file_exists($path))
{
- if (file_exists($path))
- {
- file_put_contents($path, str_replace(
- $this->laravel['config']['app.key'], $key, file_get_contents($path)
- ));
- }
+ file_put_contents($path, str_replace(
+ $this->laravel['config']['app.key'], $key, file_get_contents($path)
+ ));
}
$this->laravel['config']['app.key'] = $key; | false |
Other | laravel | framework | 41e2080cb2811e9063672248311a66f65e6d899e.json | store the generated key in the .env file only | src/Illuminate/Foundation/Console/KeyGenerateCommand.php | @@ -34,14 +34,13 @@ public function fire()
return $this->line('<comment>'.$key.'</comment>');
}
- foreach ([base_path('.env'), base_path('.env.example')] as $path)
+ $path = base_path('.env');
+
+ if (file_exists($path))
{
- if (file_exists($path))
- {
- file_put_contents($path, str_replace(
- $this->laravel['config']['app.key'], $key, file_get_contents($path)
- ));
- }
+ file_put_contents($path, str_replace(
+ $this->laravel['config']['app.key'], $key, file_get_contents($path)
+ ));
}
$this->laravel['config']['app.key'] = $key; | false |
Other | laravel | framework | 058eebfaf9124e9d475a7da966ca56a9e1c81718.json | Set the internal encoding of mastering. | src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php | @@ -38,6 +38,8 @@ public function bootstrap(Application $app)
}
date_default_timezone_set($config['app.timezone']);
+
+ mb_internal_encoding('UTF-8');
}
/** | false |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | composer.json | @@ -89,7 +89,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": { | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Auth/composer.json | @@ -10,10 +10,10 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/http": "5.0.*",
- "illuminate/session": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/http": "5.1.*",
+ "illuminate/session": "5.1.*",
+ "illuminate/support": "5.1.*",
"nesbot/carbon": "~1.0"
},
"autoload": {
@@ -23,11 +23,11 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": {
- "illuminate/console": "Required to use the auth:clear-resets command (5.0.*)."
+ "illuminate/console": "Required to use the auth:clear-resets command (5.1.*)."
},
"minimum-stability": "dev"
} | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Bus/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*"
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*"
},
"autoload": {
"psr-4": {
@@ -20,7 +20,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Cache/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"nesbot/carbon": "~1.0"
},
"autoload": {
@@ -21,13 +21,13 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": {
- "illuminate/database": "Required to use the database cache driver (5.0.*).",
- "illuminate/filesystem": "Required to use the file cache driver (5.0.*).",
- "illuminate/redis": "Required to use the redis cache driver (5.0.*)."
+ "illuminate/database": "Required to use the database cache driver (5.1.*).",
+ "illuminate/filesystem": "Required to use the file cache driver (5.1.*).",
+ "illuminate/redis": "Required to use the redis cache driver (5.1.*)."
},
"minimum-stability": "dev"
} | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Config/composer.json | @@ -10,9 +10,9 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/filesystem": "5.0.*",
- "illuminate/support": "5.0.*"
+ "illuminate/contracts": "5.1.*",
+ "illuminate/filesystem": "5.1.*",
+ "illuminate/support": "5.1.*"
},
"autoload": {
"psr-4": {
@@ -21,7 +21,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Console/composer.json | @@ -10,7 +10,7 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
+ "illuminate/contracts": "5.1.*",
"symfony/console": "2.6.*"
},
"autoload": {
@@ -20,7 +20,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": { | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Container/composer.json | @@ -10,7 +10,7 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*"
+ "illuminate/contracts": "5.1.*"
},
"autoload": {
"psr-4": {
@@ -19,7 +19,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Contracts/composer.json | @@ -18,7 +18,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Cookie/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"symfony/http-kernel": "2.6.*",
"symfony/http-foundation": "2.6.*"
},
@@ -22,7 +22,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Database/composer.json | @@ -11,9 +11,9 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/container": "5.0.*",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/container": "5.1.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"nesbot/carbon": "~1.0"
},
"autoload": {
@@ -23,13 +23,13 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": {
"doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).",
- "illuminate/console": "Required to use the database commands (5.0.*).",
- "illuminate/filesystem": "Required to use the migrations (5.0.*)."
+ "illuminate/console": "Required to use the database commands (5.1.*).",
+ "illuminate/filesystem": "Required to use the migrations (5.1.*)."
},
"minimum-stability": "dev"
} | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Encryption/composer.json | @@ -11,8 +11,8 @@
"require": {
"php": ">=5.4.0",
"ext-openssl": "*",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"symfony/security-core": "2.6.*"
},
"autoload": {
@@ -22,7 +22,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Events/composer.json | @@ -10,9 +10,9 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/container": "5.0.*",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*"
+ "illuminate/container": "5.1.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*"
},
"autoload": {
"psr-4": {
@@ -21,7 +21,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Filesystem/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"symfony/finder": "2.6.*",
"league/flysystem": "~1.0"
},
@@ -22,7 +22,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": { | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Foundation/Application.php | @@ -20,7 +20,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
- const VERSION = '5.0-dev';
+ const VERSION = '5.1-dev';
/**
* The base path for the Laravel installation. | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Hashing/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"ircmaxell/password-compat": "~1.0"
},
"autoload": {
@@ -21,7 +21,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Http/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/session": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/session": "5.1.*",
+ "illuminate/support": "5.1.*",
"symfony/http-foundation": "2.6.*",
"symfony/http-kernel": "2.6.*"
},
@@ -22,7 +22,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Log/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"monolog/monolog": "~1.11"
},
"autoload": {
@@ -21,7 +21,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Mail/composer.json | @@ -10,9 +10,9 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/container": "5.0.*",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/container": "5.1.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"psr/log": "~1.0",
"swiftmailer/swiftmailer": "~5.1"
},
@@ -23,7 +23,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": { | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Pagination/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*"
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*"
},
"autoload": {
"psr-4": {
@@ -20,7 +20,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Pipeline/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*"
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*"
},
"autoload": {
"psr-4": {
@@ -20,7 +20,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Queue/composer.json | @@ -10,11 +10,11 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/console": "5.0.*",
- "illuminate/contracts": "5.0.*",
- "illuminate/container": "5.0.*",
- "illuminate/http": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/console": "5.1.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/container": "5.1.*",
+ "illuminate/http": "5.1.*",
+ "illuminate/support": "5.1.*",
"symfony/process": "2.6.*",
"nesbot/carbon": "~1.0"
},
@@ -28,12 +28,12 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": {
"aws/aws-sdk-php": "Required to use the SQS queue driver (~2.4).",
- "illuminate/redis": "Required to use the redis queue driver (5.0.*).",
+ "illuminate/redis": "Required to use the redis queue driver (5.1.*).",
"iron-io/iron_mq": "Required to use the iron queue driver (~1.5).",
"pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0)."
}, | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Redis/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"predis/predis": "~1.0"
},
"autoload": {
@@ -21,7 +21,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Routing/composer.json | @@ -10,12 +10,12 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/container": "5.0.*",
- "illuminate/contracts": "5.0.*",
- "illuminate/http": "5.0.*",
- "illuminate/pipeline": "5.0.*",
- "illuminate/session": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/container": "5.1.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/http": "5.1.*",
+ "illuminate/pipeline": "5.1.*",
+ "illuminate/session": "5.1.*",
+ "illuminate/support": "5.1.*",
"symfony/http-foundation": "2.6.*",
"symfony/http-kernel": "2.6.*",
"symfony/routing": "2.6.*"
@@ -27,11 +27,11 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": {
- "illuminate/console": "Required to use the make commands (5.0.*)."
+ "illuminate/console": "Required to use the make commands (5.1.*)."
},
"minimum-stability": "dev"
} | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Session/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"nesbot/carbon": "~1.0",
"symfony/finder": "2.6.*",
"symfony/http-foundation": "2.6.*"
@@ -23,11 +23,11 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": {
- "illuminate/console": "Required to use the session:table command (5.0.*)."
+ "illuminate/console": "Required to use the session:table command (5.1.*)."
},
"minimum-stability": "dev"
} | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Support/composer.json | @@ -11,7 +11,7 @@
"require": {
"php": ">=5.4.0",
"ext-mbstring": "*",
- "illuminate/contracts": "5.0.*",
+ "illuminate/contracts": "5.1.*",
"doctrine/inflector": "~1.0",
"danielstjules/stringy": "~1.8"
},
@@ -25,7 +25,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": { | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Translation/composer.json | @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/filesystem": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/filesystem": "5.1.*",
+ "illuminate/support": "5.1.*",
"symfony/translation": "2.6.*"
},
"autoload": {
@@ -21,7 +21,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/Validation/composer.json | @@ -10,9 +10,9 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/container": "5.0.*",
- "illuminate/contracts": "5.0.*",
- "illuminate/support": "5.0.*",
+ "illuminate/container": "5.1.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/support": "5.1.*",
"symfony/http-foundation": "2.6.*",
"symfony/translation": "2.6.*"
},
@@ -23,11 +23,11 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"suggest": {
- "illuminate/database": "Required to use the database presence verifier (5.0.*)."
+ "illuminate/database": "Required to use the database presence verifier (5.1.*)."
},
"minimum-stability": "dev"
} | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | src/Illuminate/View/composer.json | @@ -10,10 +10,10 @@
],
"require": {
"php": ">=5.4.0",
- "illuminate/container": "5.0.*",
- "illuminate/contracts": "5.0.*",
- "illuminate/filesystem": "5.0.*",
- "illuminate/support": "5.0.*"
+ "illuminate/container": "5.1.*",
+ "illuminate/contracts": "5.1.*",
+ "illuminate/filesystem": "5.1.*",
+ "illuminate/support": "5.1.*"
},
"autoload": {
"psr-4": {
@@ -22,7 +22,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-master": "5.1-dev"
}
},
"minimum-stability": "dev" | true |
Other | laravel | framework | 7c88863f671da7465a73a7a56f8d3f5ba691a8d3.json | Update versions for 5.1 | tests/Console/ConsoleApplicationTest.php | @@ -48,7 +48,7 @@ public function testResolveAddsCommandViaApplicationResolution()
protected function getMockConsole(array $methods)
{
- $app = m::mock('Illuminate\Contracts\Foundation\Application', ['version' => '5.0']);
+ $app = m::mock('Illuminate\Contracts\Foundation\Application', ['version' => '5.1']);
$events = m::mock('Illuminate\Contracts\Events\Dispatcher', ['fire' => null]);
$console = $this->getMock('Illuminate\Console\Application', $methods, [ | true |
Other | laravel | framework | 2d640470494d47cceda56de32ba384f59444665e.json | Update build scripts. | build/illuminate-split-full.sh | @@ -1,27 +1,25 @@
git subsplit init git@github.com:laravel/framework.git
git subsplit publish src/Illuminate/Auth:git@github.com:illuminate/auth.git
-git subsplit publish --heads="master" src/Illuminate/Bus:git@github.com:illuminate/bus.git
+git subsplit publish --heads="master 5.0" src/Illuminate/Bus:git@github.com:illuminate/bus.git
git subsplit publish src/Illuminate/Cache:git@github.com:illuminate/cache.git
git subsplit publish src/Illuminate/Config:git@github.com:illuminate/config.git
git subsplit publish src/Illuminate/Console:git@github.com:illuminate/console.git
git subsplit publish src/Illuminate/Container:git@github.com:illuminate/container.git
-git subsplit publish --heads="master" src/Illuminate/Contracts:git@github.com:illuminate/contracts.git
+git subsplit publish --heads="master 5.0" src/Illuminate/Contracts:git@github.com:illuminate/contracts.git
git subsplit publish src/Illuminate/Cookie:git@github.com:illuminate/cookie.git
git subsplit publish src/Illuminate/Database:git@github.com:illuminate/database.git
git subsplit publish src/Illuminate/Encryption:git@github.com:illuminate/encryption.git
git subsplit publish src/Illuminate/Events:git@github.com:illuminate/events.git
git subsplit publish src/Illuminate/Exception:git@github.com:illuminate/exception.git
git subsplit publish src/Illuminate/Filesystem:git@github.com:illuminate/filesystem.git
git subsplit publish src/Illuminate/Hashing:git@github.com:illuminate/hashing.git
-git subsplit publish --heads="4.1 4.2" src/Illuminate/Html:git@github.com:illuminate/html.git
git subsplit publish src/Illuminate/Http:git@github.com:illuminate/http.git
git subsplit publish src/Illuminate/Log:git@github.com:illuminate/log.git
git subsplit publish src/Illuminate/Mail:git@github.com:illuminate/mail.git
git subsplit publish src/Illuminate/Pagination:git@github.com:illuminate/pagination.git
-git subsplit publish --heads="master" src/Illuminate/Pipeline:git@github.com:illuminate/pipeline.git
+git subsplit publish --heads="master 5.0" src/Illuminate/Pipeline:git@github.com:illuminate/pipeline.git
git subsplit publish src/Illuminate/Queue:git@github.com:illuminate/queue.git
git subsplit publish src/Illuminate/Redis:git@github.com:illuminate/redis.git
-git subsplit publish --heads="4.1 4.2" src/Illuminate/Remote:git@github.com:illuminate/remote.git
git subsplit publish src/Illuminate/Routing:git@github.com:illuminate/routing.git
git subsplit publish src/Illuminate/Session:git@github.com:illuminate/session.git
git subsplit publish src/Illuminate/Support:git@github.com:illuminate/support.git | true |
Other | laravel | framework | 2d640470494d47cceda56de32ba384f59444665e.json | Update build scripts. | build/illuminate-split.sh | @@ -1,31 +1,29 @@
git subsplit init git@github.com:laravel/framework.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Auth:git@github.com:illuminate/auth.git
-git subsplit publish --heads="master" --no-tags src/Illuminate/Bus:git@github.com:illuminate/bus.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Cache:git@github.com:illuminate/cache.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Config:git@github.com:illuminate/config.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Console:git@github.com:illuminate/console.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Container:git@github.com:illuminate/container.git
-git subsplit publish --heads="master" --no-tags src/Illuminate/Contracts:git@github.com:illuminate/contracts.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Cookie:git@github.com:illuminate/cookie.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Database:git@github.com:illuminate/database.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Encryption:git@github.com:illuminate/encryption.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Events:git@github.com:illuminate/events.git
-git subsplit publish --heads="4.1 4.2" --no-tags src/Illuminate/Exception:git@github.com:illuminate/exception.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Filesystem:git@github.com:illuminate/filesystem.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Hashing:git@github.com:illuminate/hashing.git
-git subsplit publish --heads="4.1 4.2" --no-tags src/Illuminate/Html:git@github.com:illuminate/html.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Http:git@github.com:illuminate/http.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Log:git@github.com:illuminate/log.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Mail:git@github.com:illuminate/mail.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Pagination:git@github.com:illuminate/pagination.git
-git subsplit publish --heads="master" --no-tags src/Illuminate/Pipeline:git@github.com:illuminate/pipeline.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Queue:git@github.com:illuminate/queue.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Redis:git@github.com:illuminate/redis.git
-git subsplit publish --heads="4.1 4.2" --no-tags src/Illuminate/Remote:git@github.com:illuminate/remote.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Routing:git@github.com:illuminate/routing.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Session:git@github.com:illuminate/session.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Support:git@github.com:illuminate/support.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Translation:git@github.com:illuminate/translation.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Validation:git@github.com:illuminate/validation.git
-git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/View:git@github.com:illuminate/view.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Auth:git@github.com:illuminate/auth.git
+git subsplit publish --heads="master 5.0" --no-tags src/Illuminate/Bus:git@github.com:illuminate/bus.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Cache:git@github.com:illuminate/cache.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Config:git@github.com:illuminate/config.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Console:git@github.com:illuminate/console.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Container:git@github.com:illuminate/container.git
+git subsplit publish --heads="master 5.0" --no-tags src/Illuminate/Contracts:git@github.com:illuminate/contracts.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Cookie:git@github.com:illuminate/cookie.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Database:git@github.com:illuminate/database.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Encryption:git@github.com:illuminate/encryption.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Events:git@github.com:illuminate/events.git
+git subsplit publish --heads="4.2" --no-tags src/Illuminate/Exception:git@github.com:illuminate/exception.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Filesystem:git@github.com:illuminate/filesystem.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Hashing:git@github.com:illuminate/hashing.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Http:git@github.com:illuminate/http.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Log:git@github.com:illuminate/log.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Mail:git@github.com:illuminate/mail.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Pagination:git@github.com:illuminate/pagination.git
+git subsplit publish --heads="master 5.0" --no-tags src/Illuminate/Pipeline:git@github.com:illuminate/pipeline.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Queue:git@github.com:illuminate/queue.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Redis:git@github.com:illuminate/redis.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Routing:git@github.com:illuminate/routing.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Session:git@github.com:illuminate/session.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Support:git@github.com:illuminate/support.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Translation:git@github.com:illuminate/translation.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/Validation:git@github.com:illuminate/validation.git
+git subsplit publish --heads="master 5.0 4.2" --no-tags src/Illuminate/View:git@github.com:illuminate/view.git
rm -rf .subsplit/ | true |
Other | laravel | framework | c633877a8a82b341127bf13a4b4cd7ea0bf9b176.json | Change "stirng" to "string" | src/Illuminate/Contracts/Queue/Queue.php | @@ -36,7 +36,7 @@ public function later($delay, $job, $data = '', $queue = null);
/**
* Push a new job onto the queue.
*
- * @param stirng $queue
+ * @param string $queue
* @param string $job
* @param mixed $data
* @return mixed | true |
Other | laravel | framework | c633877a8a82b341127bf13a4b4cd7ea0bf9b176.json | Change "stirng" to "string" | src/Illuminate/Queue/Queue.php | @@ -20,7 +20,7 @@ abstract class Queue {
/**
* Push a new job onto the queue.
*
- * @param stirng $queue
+ * @param string $queue
* @param string $job
* @param mixed $data
* @return mixed | true |
Other | laravel | framework | dfa2915aea00cd3f296e458c5f73b62824a86195.json | Update response to handle json requests as well | src/Illuminate/Foundation/Http/FormRequest.php | @@ -128,7 +128,7 @@ protected function failedAuthorization()
*/
public function response(array $errors)
{
- if ($this->ajax())
+ if ($this->ajax() || $this->wantsJson())
{
return new JsonResponse($errors, 422);
} | false |
Other | laravel | framework | f219ab878c4781ffcd1915b2e276a302f8ec935b.json | Allow configuration of storage path. | src/Illuminate/Foundation/Application.php | @@ -78,6 +78,13 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*/
protected $deferredServices = array();
+ /**
+ * The custom storage path defined by the developer.
+ *
+ * @var string
+ */
+ protected $storagePath;
+
/**
* The environment file to load during bootstrapping.
*
@@ -261,7 +268,22 @@ public function publicPath()
*/
public function storagePath()
{
- return $this->basePath.'/storage';
+ return $this->storagePath ?: $this->basePath.'/storage';
+ }
+
+ /**
+ * Set the storage directory.
+ *
+ * @param string $path
+ * @return $this
+ */
+ public function useStoragePath($path)
+ {
+ $this->storagePath = $path;
+
+ $this->instance('path.storage', $path);
+
+ return $this;
}
/** | false |
Other | laravel | framework | 5165d44c7741dd901d71ca3e9a40b14e4170d7c1.json | Use model@hydrate in builder@getModels | src/Illuminate/Database/Eloquent/Builder.php | @@ -377,26 +377,11 @@ public function onDelete(Closure $callback)
*/
public function getModels($columns = array('*'))
{
- // First, we will simply get the raw results from the query builders which we
- // can use to populate an array with Eloquent models. We will pass columns
- // that should be selected as well, which are typically just everything.
$results = $this->query->get($columns);
$connection = $this->model->getConnectionName();
- $models = array();
-
- // Once we have the results, we can spin through them and instantiate a fresh
- // model instance for each records we retrieved from the database. We will
- // also set the proper connection name for the model after we create it.
- foreach ($results as $result)
- {
- $models[] = $model = $this->model->newFromBuilder($result);
-
- $model->setConnection($connection);
- }
-
- return $models;
+ return $this->model->hydrate($results, $connection)->all();
}
/** | true |
Other | laravel | framework | 5165d44c7741dd901d71ca3e9a40b14e4170d7c1.json | Use model@hydrate in builder@getModels | src/Illuminate/Database/Eloquent/Model.php | @@ -481,59 +481,50 @@ public function newInstance($attributes = array(), $exists = false)
* Create a new model instance that is existing.
*
* @param array $attributes
+ * @param string|null $connection
* @return static
*/
- public function newFromBuilder($attributes = array())
+ public function newFromBuilder($attributes = array(), $connection = null)
{
- $instance = $this->newInstance(array(), true);
+ $model = $this->newInstance(array(), true);
- $instance->setRawAttributes((array) $attributes, true);
+ $model->setRawAttributes((array) $attributes, true);
- return $instance;
+ $model->setConnection($connection ?: $this->connection);
+
+ return $model;
}
/**
* Create a collection of models from plain arrays.
*
* @param array $items
- * @param string $connection
+ * @param string|null $connection
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function hydrate(array $items, $connection = null)
{
- $collection = with($instance = new static)->newCollection();
-
- foreach ($items as $item)
- {
- $model = $instance->newFromBuilder($item);
-
- if ( ! is_null($connection))
- {
- $model->setConnection($connection);
- }
+ $instance = (new static)->setConnection($connection);
- $collection->push($model);
- }
+ $collection = $instance->newCollection($items);
- return $collection;
+ return $collection->map(function ($item) use ($instance)
+ {
+ return $instance->newFromBuilder($item);
+ });
}
/**
* Create a collection of models from a raw query.
*
* @param string $query
* @param array $bindings
- * @param string $connection
+ * @param string|null $connection
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function hydrateRaw($query, $bindings = array(), $connection = null)
{
- $instance = new static;
-
- if ( ! is_null($connection))
- {
- $instance->setConnection($connection);
- }
+ $instance = (new static)->setConnection($connection);
$items = $instance->getConnection()->select($query, $bindings);
@@ -644,7 +635,7 @@ public static function query()
/**
* Begin querying the model on a given connection.
*
- * @param string $connection
+ * @param string|null $connection
* @return \Illuminate\Database\Eloquent\Builder
*/
public static function on($connection = null) | true |
Other | laravel | framework | 5165d44c7741dd901d71ca3e9a40b14e4170d7c1.json | Use model@hydrate in builder@getModels | tests/Database/DatabaseEloquentBuilderTest.php | @@ -234,19 +234,14 @@ public function testGetModelsProperlyHydratesModels()
$records[] = array('name' => 'taylor', 'age' => 26);
$records[] = array('name' => 'dayle', 'age' => 28);
$builder->getQuery()->shouldReceive('get')->once()->with(array('foo'))->andReturn($records);
- $model = m::mock('Illuminate\Database\Eloquent\Model[getTable,getConnectionName,newInstance]');
+ $model = m::mock('Illuminate\Database\Eloquent\Model[getTable,getConnectionName,hydrate]');
$model->shouldReceive('getTable')->once()->andReturn('foo_table');
$builder->setModel($model);
$model->shouldReceive('getConnectionName')->once()->andReturn('foo_connection');
- $model->shouldReceive('newInstance')->andReturnUsing(function() { return new EloquentBuilderTestModelStub; });
+ $model->shouldReceive('hydrate')->once()->with($records, 'foo_connection')->andReturn(new Collection(['hydrated']));
$models = $builder->getModels(array('foo'));
- $this->assertEquals('taylor', $models[0]->name);
- $this->assertEquals($models[0]->getAttributes(), $models[0]->getOriginal());
- $this->assertEquals('dayle', $models[1]->name);
- $this->assertEquals($models[1]->getAttributes(), $models[1]->getOriginal());
- $this->assertEquals('foo_connection', $models[0]->getConnectionName());
- $this->assertEquals('foo_connection', $models[1]->getConnectionName());
+ $this->assertEquals($models, ['hydrated']);
}
| true |
Other | laravel | framework | 5165d44c7741dd901d71ca3e9a40b14e4170d7c1.json | Use model@hydrate in builder@getModels | tests/Database/DatabaseEloquentIntegrationTest.php | @@ -187,6 +187,21 @@ public function testOneToManyRelationship()
}
+ public function testBasicModelHydration()
+ {
+ EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
+ EloquentTestUser::create(['email' => 'abigailotwell@gmail.com']);
+
+ $models = EloquentTestUser::hydrateRaw('SELECT * FROM users WHERE email = ?', ['abigailotwell@gmail.com'], 'foo_connection');
+
+ $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $models);
+ $this->assertInstanceOf('EloquentTestUser', $models[0]);
+ $this->assertEquals('abigailotwell@gmail.com', $models[0]->email);
+ $this->assertEquals('foo_connection', $models[0]->getConnectionName());
+ $this->assertEquals(1, $models->count());
+ }
+
+
public function testHasOnSelfReferencingBelongsToManyRelationship()
{
$user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']); | true |
Other | laravel | framework | 5165d44c7741dd901d71ca3e9a40b14e4170d7c1.json | Use model@hydrate in builder@getModels | tests/Database/DatabaseEloquentModelTest.php | @@ -73,14 +73,18 @@ public function testNewInstanceReturnsNewInstanceWithAttributesSet()
public function testHydrateCreatesCollectionOfModels()
{
$data = array(array('name' => 'Taylor'), array('name' => 'Otwell'));
- $collection = EloquentModelStub::hydrate($data);
+ $collection = EloquentModelStub::hydrate($data, 'foo_connection');
$this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $collection);
$this->assertCount(2, $collection);
$this->assertInstanceOf('EloquentModelStub', $collection[0]);
$this->assertInstanceOf('EloquentModelStub', $collection[1]);
+ $this->assertEquals($collection[0]->getAttributes(), $collection[0]->getOriginal());
+ $this->assertEquals($collection[1]->getAttributes(), $collection[1]->getOriginal());
$this->assertEquals('Taylor', $collection[0]->name);
$this->assertEquals('Otwell', $collection[1]->name);
+ $this->assertEquals('foo_connection', $collection[0]->getConnectionName());
+ $this->assertEquals('foo_connection', $collection[1]->getConnectionName());
}
| true |
Other | laravel | framework | 66ff9dfa46af106139f1a1f727f9ed051f494833.json | Fix typo in UrlGenerator | src/Illuminate/Routing/UrlGenerator.php | @@ -331,7 +331,7 @@ protected function replaceNamedParameters($path, &$parameters)
*/
protected function addQueryString($uri, array $parameters)
{
- // If the URI has a fragmnet, we will move it to the end of the URI since it will
+ // If the URI has a fragment, we will move it to the end of the URI since it will
// need to come after any query string that may be added to the URL else it is
// not going to be available. We will remove it then append it back on here.
if ( ! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) | false |
Other | laravel | framework | 45cb9128a5f3f9b2c7d280df6a01d9daf57df6a3.json | Use array_merge instead of config_merge
For simpler merging of default config. | src/Illuminate/Support/ServiceProvider.php | @@ -54,7 +54,7 @@ protected function mergeConfigFrom($key, $path)
{
$config = $this->app['config']->get($key, []);
- $this->app['config']->set($key, config_merge(require $path, $config));
+ $this->app['config']->set($key, array_merge(require $path, $config));
}
/** | false |
Other | laravel | framework | d3e96cf12e04bee156365783f96f02498cbfa173.json | Remove dead code
This appears to be left-over from before a later refactoring. This
function is never called with the `change` parameter, and the code path
for changing columns is totally different. | src/Illuminate/Database/Schema/Grammars/Grammar.php | @@ -112,14 +112,13 @@ public function compileForeign(Blueprint $blueprint, Fluent $command)
* Compile the blueprint's column definitions.
*
* @param \Illuminate\Database\Schema\Blueprint $blueprint
- * @param bool $change
* @return array
*/
- protected function getColumns(Blueprint $blueprint, $change = false)
+ protected function getColumns(Blueprint $blueprint)
{
$columns = array();
- foreach ($change ? $blueprint->getChangedColumns() : $blueprint->getAddedColumns() as $column)
+ foreach ($blueprint->getAddedColumns() as $column)
{
// Each of the column types have their own compiler functions which are tasked
// with turning the column definition into its SQL format for this platform | false |
Other | laravel | framework | 0524af4e9d18f7a8d4b1f7e9b5958580d306f024.json | Use config_merge instead of array_merge | src/Illuminate/Support/ServiceProvider.php | @@ -54,7 +54,7 @@ protected function loadConfigFrom($key, $path)
{
$defaults = $this->app['files']->getRequire($path);
$config = $this->app['config']->get($key, []);
- $this->app['config']->set($key, array_merge($defaults, $config));
+ $this->app['config']->set($key, config_merge($defaults, $config));
}
/** | false |
Other | laravel | framework | 75fa3461ee998bc1f8475de97917b94a25d5d35c.json | Add another method for more fluency. | src/Illuminate/Filesystem/FilesystemManager.php | @@ -44,6 +44,17 @@ public function __construct($app)
$this->app = $app;
}
+ /**
+ * Get a filesystem instance.
+ *
+ * @param string $name
+ * @return \Illuminate\Contracts\Filesystem\Filesystem
+ */
+ public function drive($name = null)
+ {
+ return $this->disk($name);
+ }
+
/**
* Get a filesystem instance.
* | false |
Other | laravel | framework | 2d48bbcdf613864660d652270b9cb0b7e6298cf5.json | Add disk facade. | src/Illuminate/Support/Facades/Disk.php | @@ -0,0 +1,15 @@
+<?php namespace Illuminate\Support\Facades;
+
+/**
+ * @see \Illuminate\Filesystem\FilesystemManager
+ */
+class Disk extends Facade {
+
+ /**
+ * Get the registered name of the component.
+ *
+ * @return string
+ */
+ protected static function getFacadeAccessor() { return 'filesystem'; }
+
+} | false |
Other | laravel | framework | 7700c715d712c878bbd472644227a404e8c584c5.json | Return sendRawEmail to catch the message Id. | src/Illuminate/Mail/Transport/SesTransport.php | @@ -54,7 +54,7 @@ public function stop()
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
- $this->ses->sendRawEmail([
+ return $this->ses->sendRawEmail([
'Source' => $message->getSender(),
'Destinations' => $this->getTo($message),
'RawMessage' => [ | false |
Other | laravel | framework | ef734e77237fff4c1202e0056da499ecec724b85.json | Use Collection@lists in Builder@lists | src/Illuminate/Database/Query/Builder.php | @@ -888,7 +888,7 @@ public function orWhereNotNull($column)
{
return $this->whereNotNull($column, 'or');
}
-
+
/**
* Add a "where date" statement to the query.
*
@@ -902,7 +902,7 @@ public function whereDate($column, $operator, $value, $boolean = 'and')
{
return $this->addDateBasedWhere('Date', $column, $operator, $value, $boolean);
}
-
+
/**
* Add a "where day" statement to the query.
*
@@ -1502,24 +1502,9 @@ public function lists($column, $key = null)
{
$columns = $this->getListSelect($column, $key);
- // First we will just get all of the column values for the record result set
- // then we can associate those values with the column if it was specified
- // otherwise we can just give these values back without a specific key.
$results = new Collection($this->get($columns));
- $values = $results->fetch($columns[0])->all();
-
- // If a key was specified and we have results, we will go ahead and combine
- // the values with the keys of all of the records so that the values can
- // be accessed by the key of the rows instead of simply being numeric.
- if ( ! is_null($key) && count($results) > 0)
- {
- $keys = $results->fetch($key)->all();
-
- return array_combine($keys, $values);
- }
-
- return $values;
+ return $results->lists($columns[0], array_get($columns, 1));
}
/**
@@ -1536,12 +1521,12 @@ protected function getListSelect($column, $key)
// If the selected column contains a "dot", we will remove it so that the list
// operation can run normally. Specifying the table is not needed, since we
// really want the names of the columns as it is in this resulting array.
- if (($dot = strpos($select[0], '.')) !== false)
+ return array_map(function($column)
{
- $select[0] = substr($select[0], $dot + 1);
- }
+ $dot = strpos($column, '.');
- return $select;
+ return $dot === false ? $column : substr($column, $dot + 1);
+ }, $select);
}
/** | true |
Other | laravel | framework | ef734e77237fff4c1202e0056da499ecec724b85.json | Use Collection@lists in Builder@lists | tests/Database/DatabaseEloquentIntegrationTest.php | @@ -106,6 +106,19 @@ public function testBasicModelCollectionRetrieval()
}
+ public function testListsRetrieval()
+ {
+ EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']);
+ EloquentTestUser::create(['id' => 2, 'email' => 'abigailotwell@gmail.com']);
+
+ $simple = EloquentTestUser::oldest('id')->lists('users.email');
+ $keyed = EloquentTestUser::oldest('id')->lists('users.email', 'users.id');
+
+ $this->assertEquals(['taylorotwell@gmail.com', 'abigailotwell@gmail.com'], $simple);
+ $this->assertEquals([1 => 'taylorotwell@gmail.com', 2 => 'abigailotwell@gmail.com'], $keyed);
+ }
+
+
public function testFindOrFail()
{
EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']); | true |
Other | laravel | framework | b31c47de7c9321388548f765f5d1a044060c8ed4.json | Write a simple publisher. | src/Illuminate/Foundation/Console/VendorPublishCommand.php | @@ -0,0 +1,126 @@
+<?php namespace Illuminate\Foundation\Console;
+
+use Illuminate\Console\Command;
+use Illuminate\Filesystem\Filesystem;
+use Illuminate\Support\ServiceProvider;
+
+class VendorPublishCommand extends Command {
+
+ /**
+ * The filesystem instance.
+ *
+ * @var \Illuminate\Filesystem\Filesystem
+ */
+ protected $files;
+
+ /**
+ * The console command name.
+ *
+ * @var string
+ */
+ protected $name = 'vendor:publish';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = "Publish any publishable assets from vendor packages";
+
+ /**
+ * Create a new command instance.
+ *
+ * @param \Illuminate\Filesystem\Filesystem
+ * @return void
+ */
+ public function __construct(Filesystem $files)
+ {
+ parent::__construct();
+
+ $this->files = $files;
+ }
+
+ /**
+ * Execute the console command.
+ *
+ * @return void
+ */
+ public function fire()
+ {
+ foreach (ServiceProvider::pathsToPublish() as $from => $to)
+ {
+ if ($this->files->isFile($from))
+ {
+ $this->publishFile($from, $to);
+ }
+ elseif ($this->files->isDirectory($from))
+ {
+ $this->publishDirectory($from, $to);
+ }
+ }
+ }
+
+ /**
+ * Publish the file to the given path.
+ *
+ * @param string $from
+ * @param string $to
+ * @return void
+ */
+ protected function publishFile($from, $to)
+ {
+ $this->createParentDirectory(dirname($to));
+
+ $this->files->copy($from, $to);
+
+ $this->status($from, $to, 'File');
+ }
+
+ /**
+ * Publish the directory to the given directory.
+ *
+ * @param string $from
+ * @param string $to
+ * @return void
+ */
+ protected function publishDirectory($from, $to)
+ {
+ $this->createParentDirectory($to);
+
+ $this->files->copyDirectory($from, $to);
+
+ $this->status($from, $to, 'Directory');
+ }
+
+ /**
+ * Create the directory to house the published files if needed.
+ *
+ * @param string $directory
+ * @return void
+ */
+ protected function createParentDirectory($directory)
+ {
+ if ( ! $this->files->isDirectory($directory))
+ {
+ $this->files->makeDirectory($directory, 0755, true);
+ }
+ }
+
+ /**
+ * Write a status message to the console.
+ *
+ * @param string $from
+ * @param string $to
+ * @param string $type
+ * @return void
+ */
+ protected function status($from, $to, $type)
+ {
+ $from = str_replace(base_path(), '', realpath($from));
+
+ $to = str_replace(base_path(), '', realpath($to));
+
+ $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>');
+ }
+
+} | true |
Other | laravel | framework | b31c47de7c9321388548f765f5d1a044060c8ed4.json | Write a simple publisher. | src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php | @@ -22,6 +22,7 @@
use Illuminate\Foundation\Console\ProviderMakeCommand;
use Illuminate\Foundation\Console\HandlerEventCommand;
use Illuminate\Foundation\Console\ClearCompiledCommand;
+use Illuminate\Foundation\Console\VendorPublishCommand;
use Illuminate\Foundation\Console\HandlerCommandCommand;
class ArtisanServiceProvider extends ServiceProvider {
@@ -61,6 +62,7 @@ class ArtisanServiceProvider extends ServiceProvider {
'Serve' => 'command.serve',
'Tinker' => 'command.tinker',
'Up' => 'command.up',
+ 'VendorPublish' => 'command.vendor.publish',
];
/**
@@ -366,6 +368,19 @@ protected function registerUpCommand()
});
}
+ /**
+ * Register the command.
+ *
+ * @return void
+ */
+ protected function registerVendorPublishCommand()
+ {
+ $this->app->singleton('command.vendor.publish', function($app)
+ {
+ return new VendorPublishCommand($app['files']);
+ });
+ }
+
/**
* Get the services provided by the provider.
* | true |
Other | laravel | framework | b31c47de7c9321388548f765f5d1a044060c8ed4.json | Write a simple publisher. | src/Illuminate/Foundation/helpers.php | @@ -126,6 +126,20 @@ function bcrypt($value, $options = array())
}
}
+if ( ! function_exists('collect'))
+{
+ /**
+ * Create a collection from the given value.
+ *
+ * @param mixed $value
+ * @return \Illuminate\Support\Collection
+ */
+ function collect($value)
+ {
+ return Illuminate\Support\Collection::make($value);
+ }
+}
+
if ( ! function_exists('config'))
{
/** | true |
Other | laravel | framework | b31c47de7c9321388548f765f5d1a044060c8ed4.json | Write a simple publisher. | src/Illuminate/Support/ServiceProvider.php | @@ -18,6 +18,13 @@ abstract class ServiceProvider {
*/
protected $defer = false;
+ /**
+ * The paths that should be published.
+ *
+ * @var array
+ */
+ protected static $publishes = [];
+
/**
* Create a new service provider instance.
*
@@ -45,7 +52,7 @@ abstract public function register();
*/
protected function loadViewsFrom($namespace, $path)
{
- if (is_dir($appPath = $this->app->basePath().'/resources/views/packages/'.$namespace))
+ if (is_dir($appPath = $this->app->basePath().'/resources/views/vendor/'.$namespace))
{
$this->app['view']->addNamespace($namespace, $appPath);
}
@@ -65,6 +72,27 @@ protected function loadTranslationsFrom($namespace, $path)
$this->app['translator']->addNamespace($namespace, $path);
}
+ /**
+ * Register paths to be published by the publish command.
+ *
+ * @param array $paths
+ * @return void
+ */
+ protected function publishes(array $paths)
+ {
+ static::$publishes = array_merge(static::$publishes, $paths);
+ }
+
+ /**
+ * Get the paths to publish.
+ *
+ * @return array
+ */
+ public static function pathsToPublish()
+ {
+ return static::$publishes;
+ }
+
/**
* Register the package's custom Artisan commands.
* | true |
Other | laravel | framework | f192375993d9fc269474b28d4d3034a9480ffb1f.json | Add proper release method for SqsJob | src/Illuminate/Queue/Jobs/SqsJob.php | @@ -86,7 +86,11 @@ public function release($delay = 0)
{
parent::release($delay);
- // SQS job releases are handled by the server configuration...
+ $this->sqs->changeMessageVisibility(array(
+ 'QueueUrl' => $this->queue,
+ 'ReceiptHandle' => $this->job['ReceiptHandle'],
+ 'VisibilityTimeout' => $delay
+ ));
}
/** | true |
Other | laravel | framework | f192375993d9fc269474b28d4d3034a9480ffb1f.json | Add proper release method for SqsJob | tests/Queue/QueueSqsJobTest.php | @@ -17,6 +17,7 @@ public function setUp() {
$this->account = '1234567891011';
$this->queueName = 'emails';
$this->baseUrl = 'https://sqs.someregion.amazonaws.com';
+ $this->releaseDelay = 0;
// The Aws\Common\AbstractClient needs these three constructor parameters
$this->credentials = new Credentials( $this->key, $this->secret );
@@ -73,6 +74,18 @@ public function testDeleteRemovesTheJobFromSqs()
}
+ public function testReleaseProperlyReleasesTheJobOntoSqs()
+ {
+ $this->mockedSqsClient = $this->getMock('Aws\Sqs\SqsClient', array('changeMessageVisibility'), array($this->credentials, $this->signature, $this->config));
+ $queue = $this->getMock('Illuminate\Queue\SqsQueue', array('getQueue'), array($this->mockedSqsClient, $this->queueName, $this->account));
+ $queue->setContainer($this->mockedContainer);
+ $job = $this->getJob();
+ $job->getSqs()->expects($this->once())->method('changeMessageVisibility')->with(array('QueueUrl' => $this->queueUrl, 'ReceiptHandle' => $this->mockedReceiptHandle, 'VisibilityTimeout' => $this->releaseDelay));
+ $job->release($this->releaseDelay);
+ $this->assertTrue($job->isReleased());
+ }
+
+
protected function getJob()
{
return new Illuminate\Queue\Jobs\SqsJob( | true |
Other | laravel | framework | 25b4791d7aa4d7c1a833553ac7c3d8de648eedea.json | Add __call to filesystem manager. | src/Illuminate/Filesystem/FilesystemManager.php | @@ -207,4 +207,16 @@ public function extend($driver, Closure $callback)
return $this;
}
+ /**
+ * Dynamically call the default driver instance.
+ *
+ * @param string $method
+ * @param array $parameters
+ * @return mixed
+ */
+ public function __call($method, $parameters)
+ {
+ return call_user_func_array(array($this->disk(), $method), $parameters);
+ }
+
} | false |
Other | laravel | framework | 2f59c2c5459530e9a0be8c40ac536c06f3e99973.json | Remove unnecessary findOrFail method | src/Illuminate/Database/Eloquent/Model.php | @@ -714,20 +714,6 @@ public static function findOrNew($id, $columns = array('*'))
return new static;
}
- /**
- * Find a model by its primary key or throw an exception.
- *
- * @param mixed $id
- * @param array $columns
- * @return \Illuminate\Support\Collection|static
- *
- * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
- */
- public static function findOrFail($id, $columns = array('*'))
- {
- return static::query()->findOrFail($id, $columns);
- }
-
/**
* Reload a fresh model instance from the database.
* | true |
Other | laravel | framework | 2f59c2c5459530e9a0be8c40ac536c06f3e99973.json | Remove unnecessary findOrFail method | tests/Database/DatabaseEloquentIntegrationTest.php | @@ -106,6 +106,39 @@ public function testBasicModelCollectionRetrieval()
}
+ public function testFindOrFail()
+ {
+ EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']);
+ EloquentTestUser::create(['id' => 2, 'email' => 'abigailotwell@gmail.com']);
+
+ $single = EloquentTestUser::findOrFail(1);
+ $multiple = EloquentTestUser::findOrFail([1, 2]);
+
+ $this->assertInstanceOf('EloquentTestUser', $single);
+ $this->assertEquals('taylorotwell@gmail.com', $single->email);
+ $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $multiple);
+ $this->assertInstanceOf('EloquentTestUser', $multiple[0]);
+ $this->assertInstanceOf('EloquentTestUser', $multiple[1]);
+ }
+
+ /**
+ * @expectedException Illuminate\Database\Eloquent\ModelNotFoundException
+ */
+ public function testFindOrFailWithSingleIdThrowsModelNotFoundException()
+ {
+ EloquentTestUser::findOrFail(1);
+ }
+
+ /**
+ * @expectedException Illuminate\Database\Eloquent\ModelNotFoundException
+ */
+ public function testFindOrFailWithMultipleIdsThrowsModelNotFoundException()
+ {
+ EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']);
+ EloquentTestUser::findOrFail([1, 2]);
+ }
+
+
public function testHasOnSelfReferencingBelongsToManyRelationship()
{
$user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']); | true |
Other | laravel | framework | 2f59c2c5459530e9a0be8c40ac536c06f3e99973.json | Remove unnecessary findOrFail method | tests/Database/DatabaseEloquentModelTest.php | @@ -113,15 +113,6 @@ public function testFindMethodUseWritePdo()
}
- /**
- * @expectedException Illuminate\Database\Eloquent\ModelNotFoundException
- */
- public function testFindOrFailMethodThrowsModelNotFoundException()
- {
- $result = EloquentModelFindNotFoundStub::findOrFail(1);
- }
-
-
public function testFindMethodWithArrayCallsQueryBuilderCorrectly()
{
$result = EloquentModelFindManyStub::find(array(1, 2));
@@ -1263,15 +1254,6 @@ public function newQuery()
}
}
-class EloquentModelFindNotFoundStub extends Illuminate\Database\Eloquent\Model {
- public static function query()
- {
- $mock = m::mock('Illuminate\Database\Eloquent\Builder');
- $mock->shouldReceive('findOrFail')->once()->with(1, array('*'))->andThrow(new ModelNotFoundException);
- return $mock;
- }
-}
-
class EloquentModelDestroyStub extends Illuminate\Database\Eloquent\Model {
public function newQuery()
{ | true |
Other | laravel | framework | 421228dfee48dd456b06790e4db690a8918595de.json | Fix eloquent integration test | tests/Database/DatabaseEloquentIntegrationTest.php | @@ -3,7 +3,7 @@
use Illuminate\Database\Connection;
use Illuminate\Database\Eloquent\Model as Eloquent;
-class DatabaseEloquentIntegrationTests extends PHPUnit_Framework_TestCase {
+class DatabaseEloquentIntegrationTest extends PHPUnit_Framework_TestCase {
/**
* Bootstrap Eloquent.
@@ -95,14 +95,14 @@ public function testBasicModelCollectionRetrieval()
EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']);
EloquentTestUser::create(['id' => 2, 'email' => 'abigailotwell@gmail.com']);
- $models = EloquentTestUser::oldest('id');
+ $models = EloquentTestUser::oldest('id')->get();
$this->assertEquals(2, $models->count());
$this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $models);
$this->assertInstanceOf('EloquentTestUser', $models[0]);
$this->assertInstanceOf('EloquentTestUser', $models[1]);
- $this->assertInstanceOf('taylorotwell@gmail.com', $models[0]->email);
- $this->assertInstanceOf('abigailotwell@gmail.com', $models[1]->email);
+ $this->assertEquals('taylorotwell@gmail.com', $models[0]->email);
+ $this->assertEquals('abigailotwell@gmail.com', $models[1]->email);
}
| false |
Other | laravel | framework | c690f8b0e8286abb326e459ccc24e502fd6dc211.json | Add eloquent integration tests | tests/Database/DatabaseEloquentIntegrationTests.php | @@ -56,6 +56,13 @@ public function setUp()
$table->string('name');
$table->timestamps();
});
+
+ $this->schema()->create('photos', function($table) {
+ $table->increments('id');
+ $table->morphs('imageable');
+ $table->string('name');
+ $table->timestamps();
+ });
}
@@ -69,6 +76,7 @@ public function tearDown()
$this->schema()->drop('users');
$this->schema()->drop('friends');
$this->schema()->drop('posts');
+ $this->schema()->drop('photos');
}
/**
@@ -82,6 +90,22 @@ public function testBasicModelRetrieval()
}
+ public function testBasicModelCollectionRetrieval()
+ {
+ EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']);
+ EloquentTestUser::create(['id' => 2, 'email' => 'abigailotwell@gmail.com']);
+
+ $models = EloquentTestUser::oldest('id');
+
+ $this->assertEquals(2, $models->count());
+ $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $models);
+ $this->assertInstanceOf('EloquentTestUser', $models[0]);
+ $this->assertInstanceOf('EloquentTestUser', $models[1]);
+ $this->assertInstanceOf('taylorotwell@gmail.com', $models[0]->email);
+ $this->assertInstanceOf('abigailotwell@gmail.com', $models[1]->email);
+ }
+
+
public function testHasOnSelfReferencingBelongsToManyRelationship()
{
$user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
@@ -106,6 +130,37 @@ public function testBasicHasManyEagerLoading()
$this->assertEquals('taylorotwell@gmail.com', $post->first()->user->email);
}
+
+ public function testBasicMorphManyRelationship()
+ {
+ $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
+ $user->photos()->create(['name' => 'Avatar 1']);
+ $user->photos()->create(['name' => 'Avatar 2']);
+ $post = $user->posts()->create(['name' => 'First Post']);
+ $post->photos()->create(['name' => 'Hero 1']);
+ $post->photos()->create(['name' => 'Hero 2']);
+
+ $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $user->photos);
+ $this->assertInstanceOf('EloquentTestPhoto', $user->photos[0]);
+ $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $post->photos);
+ $this->assertInstanceOf('EloquentTestPhoto', $post->photos[0]);
+ $this->assertEquals(2, $user->photos->count());
+ $this->assertEquals(2, $post->photos->count());
+ $this->assertEquals('Avatar 1', $user->photos[0]->name);
+ $this->assertEquals('Avatar 2', $user->photos[1]->name);
+ $this->assertEquals('Hero 1', $post->photos[0]->name);
+ $this->assertEquals('Hero 2', $post->photos[1]->name);
+
+ $photos = EloquentTestPhoto::orderBy('name')->get();
+
+ $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $photos);
+ $this->assertEquals(4, $photos->count());
+ $this->assertInstanceOf('EloquentTestUser', $photos[0]->imageable);
+ $this->assertInstanceOf('EloquentTestPost', $photos[2]->imageable);
+ $this->assertEquals('taylorotwell@gmail.com', $photos[1]->imageable->email);
+ $this->assertEquals('First Post', $photos[3]->imageable->name);
+ }
+
/**
* Helpers...
*/
@@ -142,9 +197,15 @@ class EloquentTestUser extends Eloquent {
public function friends() {
return $this->belongsToMany('EloquentTestUser', 'friends', 'user_id', 'friend_id');
}
+ public function friend() {
+ return $this->hasOne('EloquentTestUser', 'user_id', 'friend_id');
+ }
public function posts() {
return $this->hasMany('EloquentTestPost', 'user_id');
}
+ public function photos() {
+ return $this->morphMany('EloquentTestPhoto', 'imageable');
+ }
}
class EloquentTestPost extends Eloquent {
@@ -153,6 +214,17 @@ class EloquentTestPost extends Eloquent {
public function user() {
return $this->belongsTo('EloquentTestUser', 'user_id');
}
+ public function photos() {
+ return $this->morphMany('EloquentTestPhoto', 'imageable');
+ }
+}
+
+class EloquentTestPhoto extends Eloquent {
+ protected $table = 'photos';
+ protected $guarded = [];
+ public function imageable(){
+ return $this->morphTo();
+ }
}
/** | false |
Other | laravel | framework | 3f5863966d90b5f76b3adb3582bc0b33569a3ccc.json | Fix a bug with how commands are queued. | src/Illuminate/Foundation/Console/Kernel.php | @@ -180,24 +180,7 @@ public function bootstrap()
$this->app->bootstrapWith($this->bootstrappers());
}
- // If we are just calling another queue command, we will only load the queue
- // service provider. This saves a lot of file loading as we don't need to
- // load the providers with commands for every possible console command.
- $this->isCallingAQueueCommand()
- ? $this->app->loadDeferredProvider('queue')
- : $this->app->loadDeferredProviders();
- }
-
- /**
- * Determine if the console is calling a queue command.
- *
- * @return bool
- */
- protected function isCallingAQueueCommand()
- {
- return in_array((new ArgvInput)->getFirstArgument(), [
- 'queue:listen', 'queue:work'
- ]);
+ $this->app->loadDeferredProviders();
}
/** | false |
Other | laravel | framework | bfd01c401f632d5701fee171c24d2b515527a176.json | Set the e-mail subject to something reasonable. | src/Illuminate/Foundation/Auth/ResetsPasswords.php | @@ -41,7 +41,12 @@ public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required']);
- switch ($response = $this->passwords->sendResetLink($request->only('email')))
+ $response = $this->passwords->sendResetLink($request->only('email'), function($m)
+ {
+ $m->subject($this->getEmailSubject());
+ });
+
+ switch ($response)
{
case PasswordBroker::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
@@ -51,6 +56,16 @@ public function postEmail(Request $request)
}
}
+ /**
+ * Get the e-mail subject line to be used for the reset link email.
+ *
+ * @return string
+ */
+ protected function getEmailSubject()
+ {
+ return isset($this->subject) ? $this->subject : 'Your Password Reset Link';
+ }
+
/**
* Display the password reset view for the given token.
* | false |
Other | laravel | framework | 056cca40af72c26ab2320398935dfcfd4d62d59d.json | Remove config cache. | src/Illuminate/Config/Repository.php | @@ -12,13 +12,6 @@ class Repository implements ArrayAccess, ConfigContract {
*/
protected $items = [];
- /**
- * The cache of configuration items.
- *
- * @var array
- */
- protected $cache = [];
-
/**
* Create a new configuration repository.
*
@@ -50,12 +43,7 @@ public function has($key)
*/
public function get($key, $default = null)
{
- if (isset($this->cache[$key]) && is_null($default))
- {
- return $this->cache[$key];
- }
-
- return $this->cache[$key] = array_get($this->items, $key, $default);
+ return array_get($this->items, $key, $default);
}
/**
@@ -72,15 +60,11 @@ public function set($key, $value = null)
foreach ($key as $innerKey => $innerValue)
{
array_set($this->items, $innerKey, $innerValue);
-
- unset($this->cache[$innerKey]);
}
}
else
{
array_set($this->items, $key, $value);
-
- unset($this->cache[$key]);
}
}
| false |
Other | laravel | framework | ad981a10ee3b46fa08afc36e8dadb76a12df6486.json | Get migration path from parent | src/Illuminate/Database/Console/Migrations/StatusCommand.php | @@ -76,7 +76,7 @@ public function fire()
*/
protected function getAllMigrationFiles()
{
- return $this->migrator->getMigrationFiles($this->laravel['path.database'].'/migrations');
+ return $this->migrator->getMigrationFiles($this->getMigrationPath());
}
} | false |
Other | laravel | framework | d51fb166aa48feaf1cd6eaaddd265f11f3f7d092.json | Remove constructor ... move to app. | src/Illuminate/Foundation/Auth/ResetsPasswords.php | @@ -21,21 +21,6 @@ trait ResetsPasswords {
*/
protected $passwords;
- /**
- * Create a new password controller instance.
- *
- * @param Guard $auth
- * @param PasswordBroker $passwords
- * @return void
- */
- public function __construct(Guard $auth, PasswordBroker $passwords)
- {
- $this->auth = $auth;
- $this->passwords = $passwords;
-
- $this->middleware('guest');
- }
-
/**
* Display the form to request a password reset link.
* | false |
Other | laravel | framework | beb0a182178c953a295e3b566e0983c1fbc8ca99.json | Update flysystem references. | composer.json | @@ -71,6 +71,8 @@
"require-dev": {
"aws/aws-sdk-php": "~2.7",
"iron-io/iron_mq": "~1.5",
+ "league/flysystem-aws-s3-v2": "~1.0",
+ "league/flysystem-rackspace": "~1.0",
"pda/pheanstalk": "~3.0",
"mockery/mockery": "~0.9",
"phpunit/phpunit": "~4.0" | true |
Other | laravel | framework | beb0a182178c953a295e3b566e0983c1fbc8ca99.json | Update flysystem references. | src/Illuminate/Filesystem/FilesystemManager.php | @@ -5,9 +5,9 @@
use OpenCloud\Rackspace;
use League\Flysystem\FilesystemInterface;
use League\Flysystem\Filesystem as Flysystem;
-use League\Flysystem\Adapter\AwsS3 as S3Adapter;
+use League\Flysystem\Rackspace\RackspaceAdapter;
use League\Flysystem\Adapter\Local as LocalAdapter;
-use League\Flysystem\Adapter\Rackspace as RackspaceAdapter;
+use League\Flysystem\AwsS3v3\AwsS3Adapter as S3Adapter;
use Illuminate\Contracts\Filesystem\Factory as FactoryContract;
class FilesystemManager implements FactoryContract {
@@ -25,7 +25,7 @@ class FilesystemManager implements FactoryContract {
* @var array
*/
protected $disks = [];
-
+
/**
* The registered custom driver creators.
*
@@ -77,17 +77,17 @@ protected function get($name)
protected function resolve($name)
{
$config = $this->getConfig($name);
-
+
if (isset($this->customCreators[$config['driver']]))
{
return $this->callCustomCreator($config);
}
else
{
return $this->{"create".ucfirst($config['driver'])."Driver"}($config);
- }
+ }
}
-
+
/**
* Call a custom driver creator.
*
@@ -97,7 +97,7 @@ protected function resolve($name)
protected function callCustomCreator(array $config)
{
$driver = $this->customCreators[$config['driver']]($this->app, $config);
-
+
if ($driver instanceof FilesystemInterface)
{
return $this->adapt($driver);
@@ -196,7 +196,7 @@ public function getDefaultDriver()
{
return $this->app['config']['filesystems.default'];
}
-
+
/**
* Register a custom driver creator Closure.
*
@@ -207,7 +207,7 @@ public function getDefaultDriver()
public function extend($driver, Closure $callback)
{
$this->customCreators[$driver] = $callback;
-
+
return $this;
}
| true |
Other | laravel | framework | 9003836c20d18b930b6cb9225a78241b3ba22eb9.json | Remove unneeded stub class. | tests/Database/DatabaseMigrationMakeCommandTest.php | @@ -12,7 +12,7 @@ public function tearDown()
public function testBasicCreateDumpsAutoload()
{
- $command = new DatabaseMigrationMakeCommandTestStub(
+ $command = new MigrateMakeCommand(
$creator = m::mock('Illuminate\Database\Migrations\MigrationCreator'),
$composer = m::mock('Illuminate\Foundation\Composer'),
__DIR__.'/vendor'
@@ -28,7 +28,7 @@ public function testBasicCreateDumpsAutoload()
public function testBasicCreateGivesCreatorProperArguments()
{
- $command = new DatabaseMigrationMakeCommandTestStub(
+ $command = new MigrateMakeCommand(
$creator = m::mock('Illuminate\Database\Migrations\MigrationCreator'),
m::mock('Illuminate\Foundation\Composer')->shouldIgnoreMissing(),
__DIR__.'/vendor'
@@ -44,7 +44,7 @@ public function testBasicCreateGivesCreatorProperArguments()
public function testBasicCreateGivesCreatorProperArgumentsWhenTableIsSet()
{
- $command = new DatabaseMigrationMakeCommandTestStub(
+ $command = new MigrateMakeCommand(
$creator = m::mock('Illuminate\Database\Migrations\MigrationCreator'),
m::mock('Illuminate\Foundation\Composer')->shouldIgnoreMissing(),
__DIR__.'/vendor'
@@ -64,13 +64,3 @@ protected function runCommand($command, $input = array())
}
}
-
-
-
-class DatabaseMigrationMakeCommandTestStub extends MigrateMakeCommand
-{
- public function call($command, array $arguments = array())
- {
- //
- }
-} | false |
Other | laravel | framework | e83cd52f8c99e147c677a715662b1d5fd93052c4.json | Fix return type. | src/Illuminate/Console/Scheduling/CallbackEvent.php | @@ -43,7 +43,7 @@ public function __construct($callback, array $parameters = array())
* Run the given event.
*
* @param \Illuminate\Contracts\Container\Container $container
- * @return void
+ * @return mixed
*/
public function run(Container $container)
{ | false |
Other | laravel | framework | 735781170381b8a3d07e89961ab83b8394dc444f.json | Fix types in console classes. | src/Illuminate/Console/Application.php | @@ -14,7 +14,7 @@ class Application extends SymfonyApplication implements ApplicationContract {
/**
* The Laravel application instance.
*
- * @var \Illuminate\Foundation\Application
+ * @var \Illuminate\Contracts\Foundation\Application
*/
protected $laravel;
| true |
Other | laravel | framework | 735781170381b8a3d07e89961ab83b8394dc444f.json | Fix types in console classes. | src/Illuminate/Console/Command.php | @@ -8,13 +8,14 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
+use Illuminate\Contracts\Foundation\Application as LaravelApplication;
class Command extends \Symfony\Component\Console\Command\Command {
/**
* The Laravel application instance.
*
- * @var \Illuminate\Foundation\Application
+ * @var \Illuminate\Contracts\Foundation\Application
*/
protected $laravel;
@@ -365,7 +366,7 @@ public function getOutput()
/**
* Get the Laravel application instance.
*
- * @return \Illuminate\Foundation\Application
+ * @return \Illuminate\Contracts\Foundation\Application
*/
public function getLaravel()
{
@@ -375,10 +376,10 @@ public function getLaravel()
/**
* Set the Laravel application instance.
*
- * @param \Illuminate\Foundation\Application $laravel
+ * @param \Illuminate\Contracts\Foundation\Application $laravel
* @return void
*/
- public function setLaravel($laravel)
+ public function setLaravel(LaravelApplication $laravel)
{
$this->laravel = $laravel;
} | true |
Other | laravel | framework | 08bc627c6772b210263236c28be589af25e1f364.json | add getMorphType method in MorphTo | src/Illuminate/Database/Eloquent/Relations/MorphTo.php | @@ -194,6 +194,16 @@ public function createModelByType($type)
return new $type;
}
+ /**
+ * Get the foreign key "type" name.
+ *
+ * @return string
+ */
+ public function getMorphType()
+ {
+ return $this->morphType;
+ }
+
/**
* Get the dictionary used by the relationship.
* | false |
Other | laravel | framework | 5b0bc6cc0218c0035466a66be75ab51098fa163c.json | Add a test for overriding raw tags | tests/View/ViewBladeCompilerTest.php | @@ -169,6 +169,17 @@ public function testReversedEchosAreCompiled()
}
+ public function testShortRawEchosAreCompiled()
+ {
+ $compiler = new BladeCompiler($this->getFiles(), __DIR__);
+ $compiler->setRawTags('{{', '}}');
+ $this->assertEquals('<?php echo $name; ?>', $compiler->compileString('{{$name}}'));
+ $this->assertEquals('<?php echo $name; ?>', $compiler->compileString('{{ $name }}'));
+ $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{{$name}}}'));
+ $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{{ $name }}}'));
+ }
+
+
public function testExtendsAreCompiled()
{
$compiler = new BladeCompiler($this->getFiles(), __DIR__); | false |
Other | laravel | framework | 910d49bbbc73d7fc28625966134f9387853800ad.json | Fix wording on Filesystem disk() phpdocs | src/Illuminate/Filesystem/FilesystemManager.php | @@ -37,7 +37,7 @@ public function __construct($app)
}
/**
- * Get an OAuth provider implementation.
+ * Get a filesystem instance.
*
* @param string $name
* @return \Illuminate\Contracts\Filesystem\Filesystem | false |
Other | laravel | framework | 9c04ced0e76310b0913a8c0212cbdcb407e59824.json | Fix unintentional hardcoded name in useSyslog | src/Illuminate/Log/Writer.php | @@ -241,7 +241,7 @@ public function useDailyFiles($path, $days = 0, $level = 'debug')
*/
public function useSyslog($name = 'laravel', $level = 'debug')
{
- return $this->monolog->pushHandler(new SyslogHandler('laravel', LOG_USER, $level));
+ return $this->monolog->pushHandler(new SyslogHandler($name, LOG_USER, $level));
}
/** | false |
Other | laravel | framework | 6c150a23209a06329dc82b5e70060170f0874ac0.json | Update some docblocks | src/Illuminate/Cookie/Guard.php | @@ -126,7 +126,7 @@ protected function encrypt(Response $response)
/**
* Duplicate a cookie with a new value.
*
- * @param \Symfony\Component\HttpFoundation\Cookie $cookie
+ * @param \Symfony\Component\HttpFoundation\Cookie $c
* @param mixed $value
* @return \Symfony\Component\HttpFoundation\Cookie
*/ | true |
Other | laravel | framework | 6c150a23209a06329dc82b5e70060170f0874ac0.json | Update some docblocks | src/Illuminate/Database/Eloquent/Model.php | @@ -1288,6 +1288,7 @@ public function getObservableEvents()
/**
* Set the observable event names.
*
+ * @param array $observables
* @return void
*/
public function setObservableEvents(array $observables)
@@ -1923,6 +1924,7 @@ public function getKeyName()
/**
* Set the primary key for the model.
*
+ * @param string $key
* @return void
*/
public function setKeyName($key) | true |
Other | laravel | framework | 6c150a23209a06329dc82b5e70060170f0874ac0.json | Update some docblocks | src/Illuminate/Database/Schema/Blueprint.php | @@ -661,6 +661,7 @@ public function binary($column)
* Add the proper columns for a polymorphic table.
*
* @param string $name
+ * @param string|null $indexName
* @return void
*/
public function morphs($name, $indexName = null) | true |
Other | laravel | framework | 6c150a23209a06329dc82b5e70060170f0874ac0.json | Update some docblocks | src/Illuminate/Foundation/Console/RoutesCommand.php | @@ -94,7 +94,6 @@ protected function getRoutes()
/**
* Get the route information for a given route.
*
- * @param string $name
* @param \Illuminate\Routing\Route $route
* @return array
*/ | true |
Other | laravel | framework | 6c150a23209a06329dc82b5e70060170f0874ac0.json | Update some docblocks | src/Illuminate/Html/FormBuilder.php | @@ -392,7 +392,8 @@ protected function setQuickTextAreaSize($options)
* Create a number input field.
*
* @param string $name
- * @param array $options
+ * @param string|null $value
+ * @param array $options
* @return string
*/
public function number($name, $value = null, $options = array()) | true |
Other | laravel | framework | e6e1635b2861cd84e41186fbb4bf95a29da5e290.json | Add method to get Flysystem driver. | src/Illuminate/Filesystem/FilesystemAdapter.php | @@ -302,4 +302,14 @@ protected function parseVisibility($visibility)
throw new InvalidArgumentException('Unknown visibility: '.$visibility);
}
+ /**
+ * Get the Flysystem driver.
+ *
+ * @return \League\Flysystem\FilesystemInterface
+ */
+ protected function getDriver()
+ {
+ return $this->driver;
+ }
+
} | false |
Other | laravel | framework | 3264ebd87c64353bcaaf01e3cd2be2a91271df59.json | Add resources method to router. | src/Illuminate/Routing/Router.php | @@ -299,6 +299,20 @@ protected function addFallthroughRoute($controller, $uri)
$missing->where('_missing', '(.*)');
}
+ /**
+ * Register an array of resource controllers.
+ *
+ * @param array $resources
+ * @return void
+ */
+ public function resources(array $resources)
+ {
+ foreach ($resources as $name => $controller)
+ {
+ $this->resource($name, $controller);
+ }
+ }
+
/**
* Route a resource to a controller.
* | false |
Other | laravel | framework | 5af31ee766de486162fe3e56c96ecaba3197996b.json | Add an event helper. | src/Illuminate/Foundation/helpers.php | @@ -572,6 +572,22 @@ function env($key, $default = null)
}
}
+if ( ! function_exists('event'))
+{
+ /**
+ * Fire an event and call the listeners.
+ *
+ * @param string $event
+ * @param mixed $payload
+ * @param bool $halt
+ * @return array|null
+ */
+ function event($event, $payload = array(), $halt = false)
+ {
+ return app('events')->fire($event, $payload, $halt);
+ }
+}
+
if ( ! function_exists('elixir'))
{
/**
@@ -596,5 +612,4 @@ function elixir($file)
throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
}
-
} | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.