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 | 39c154c6ebcd1c28321d18b431ca703e3c8460a7.json | Apply fixes from StyleCI (#25904) | tests/Console/ConsoleApplicationTest.php | @@ -4,7 +4,6 @@
use Mockery as m;
use PHPUnit\Framework\TestCase;
-use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Command\Command;
use Illuminate\Contracts\Foundation\Application;
| false |
Other | laravel | framework | df0e059f492a17b52d2c4957966aad6358c1abc9.json | add missing @throws docblock (#25887) | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | @@ -1591,6 +1591,8 @@ public function isValidFileInstance($value)
* @param mixed $second
* @param string $operator
* @return bool
+ *
+ * @throws \InvalidArgumentException
*/
protected function compare($first, $second, $operator)
{ | false |
Other | laravel | framework | 8f0f9bf0269df7200069485d3dd854aa633589a9.json | Use class notation in Container tests (#25881) | tests/Container/ContainerTest.php | @@ -523,16 +523,16 @@ public function testCallWithAtSignBasedClassReferencesWithoutMethodThrowsExcepti
public function testCallWithAtSignBasedClassReferences()
{
$container = new Container;
- $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@work', ['foo', 'bar']);
+ $result = $container->call(ContainerTestCallStub::class.'@work', ['foo', 'bar']);
$this->assertEquals(['foo', 'bar'], $result);
$container = new Container;
- $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@inject');
+ $result = $container->call(ContainerTestCallStub::class.'@inject');
$this->assertInstanceOf(ContainerConcreteStub::class, $result[0]);
$this->assertEquals('taylor', $result[1]);
$container = new Container;
- $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@inject', ['default' => 'foo']);
+ $result = $container->call(ContainerTestCallStub::class.'@inject', ['default' => 'foo']);
$this->assertInstanceOf(ContainerConcreteStub::class, $result[0]);
$this->assertEquals('foo', $result[1]);
@@ -568,14 +568,14 @@ public function testCallWithGlobalMethodName()
public function testCallWithBoundMethod()
{
$container = new Container;
- $container->bindMethod('Illuminate\Tests\Container\ContainerTestCallStub@unresolvable', function ($stub) {
+ $container->bindMethod(ContainerTestCallStub::class.'@unresolvable', function ($stub) {
return $stub->unresolvable('foo', 'bar');
});
- $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@unresolvable');
+ $result = $container->call(ContainerTestCallStub::class.'@unresolvable');
$this->assertEquals(['foo', 'bar'], $result);
$container = new Container;
- $container->bindMethod('Illuminate\Tests\Container\ContainerTestCallStub@unresolvable', function ($stub) {
+ $container->bindMethod(ContainerTestCallStub::class.'@unresolvable', function ($stub) {
return $stub->unresolvable('foo', 'bar');
});
$result = $container->call([new ContainerTestCallStub, 'unresolvable']);
@@ -588,7 +588,7 @@ public function testBindMethodAcceptsAnArray()
$container->bindMethod([ContainerTestCallStub::class, 'unresolvable'], function ($stub) {
return $stub->unresolvable('foo', 'bar');
});
- $result = $container->call('Illuminate\Tests\Container\ContainerTestCallStub@unresolvable');
+ $result = $container->call(ContainerTestCallStub::class.'@unresolvable');
$this->assertEquals(['foo', 'bar'], $result);
$container = new Container;
@@ -648,13 +648,13 @@ public function testContextualBindingWorksForNewlyInstancedBindings()
{
$container = new Container;
- $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
+ $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
- $container->instance('Illuminate\Tests\Container\IContainerContractStub', new ContainerImplementationStub);
+ $container->instance(IContainerContractStub::class, new ContainerImplementationStub);
$this->assertInstanceOf(
- 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
+ ContainerImplementationStubTwo::class,
+ $container->make(ContainerTestContextInjectOne::class)->impl
);
}
@@ -663,43 +663,43 @@ public function testContextualBindingWorksOnExistingAliasedInstances()
$container = new Container;
$container->instance('stub', new ContainerImplementationStub);
- $container->alias('stub', 'Illuminate\Tests\Container\IContainerContractStub');
+ $container->alias('stub', IContainerContractStub::class);
- $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
+ $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
$this->assertInstanceOf(
- 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
+ ContainerImplementationStubTwo::class,
+ $container->make(ContainerTestContextInjectOne::class)->impl
);
}
public function testContextualBindingWorksOnNewAliasedInstances()
{
$container = new Container;
- $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
+ $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
$container->instance('stub', new ContainerImplementationStub);
- $container->alias('stub', 'Illuminate\Tests\Container\IContainerContractStub');
+ $container->alias('stub', IContainerContractStub::class);
$this->assertInstanceOf(
- 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
+ ContainerImplementationStubTwo::class,
+ $container->make(ContainerTestContextInjectOne::class)->impl
);
}
public function testContextualBindingWorksOnNewAliasedBindings()
{
$container = new Container;
- $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
+ $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
$container->bind('stub', ContainerImplementationStub::class);
- $container->alias('stub', 'Illuminate\Tests\Container\IContainerContractStub');
+ $container->alias('stub', IContainerContractStub::class);
$this->assertInstanceOf(
- 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
+ ContainerImplementationStubTwo::class,
+ $container->make(ContainerTestContextInjectOne::class)->impl
);
}
@@ -708,18 +708,18 @@ public function testContextualBindingDoesntOverrideNonContextualResolution()
$container = new Container;
$container->instance('stub', new ContainerImplementationStub);
- $container->alias('stub', 'Illuminate\Tests\Container\IContainerContractStub');
+ $container->alias('stub', IContainerContractStub::class);
- $container->when('Illuminate\Tests\Container\ContainerTestContextInjectTwo')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
+ $container->when(ContainerTestContextInjectTwo::class)->needs(IContainerContractStub::class)->give(ContainerImplementationStubTwo::class);
$this->assertInstanceOf(
- 'Illuminate\Tests\Container\ContainerImplementationStubTwo',
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectTwo')->impl
+ ContainerImplementationStubTwo::class,
+ $container->make(ContainerTestContextInjectTwo::class)->impl
);
$this->assertInstanceOf(
- 'Illuminate\Tests\Container\ContainerImplementationStub',
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne')->impl
+ ContainerImplementationStub::class,
+ $container->make(ContainerTestContextInjectOne::class)->impl
);
}
@@ -729,38 +729,38 @@ public function testContextuallyBoundInstancesAreNotUnnecessarilyRecreated()
$container = new Container;
- $container->instance('Illuminate\Tests\Container\IContainerContractStub', new ContainerImplementationStub);
- $container->instance('Illuminate\Tests\Container\ContainerTestContextInjectInstantiations', new ContainerTestContextInjectInstantiations);
+ $container->instance(IContainerContractStub::class, new ContainerImplementationStub);
+ $container->instance(ContainerTestContextInjectInstantiations::class, new ContainerTestContextInjectInstantiations);
$this->assertEquals(1, ContainerTestContextInjectInstantiations::$instantiations);
- $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('Illuminate\Tests\Container\IContainerContractStub')->give('Illuminate\Tests\Container\ContainerTestContextInjectInstantiations');
+ $container->when(ContainerTestContextInjectOne::class)->needs(IContainerContractStub::class)->give(ContainerTestContextInjectInstantiations::class);
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
- $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
+ $container->make(ContainerTestContextInjectOne::class);
+ $container->make(ContainerTestContextInjectOne::class);
+ $container->make(ContainerTestContextInjectOne::class);
+ $container->make(ContainerTestContextInjectOne::class);
$this->assertEquals(1, ContainerTestContextInjectInstantiations::$instantiations);
}
public function testContainerTags()
{
$container = new Container;
- $container->tag('Illuminate\Tests\Container\ContainerImplementationStub', 'foo', 'bar');
- $container->tag('Illuminate\Tests\Container\ContainerImplementationStubTwo', ['foo']);
+ $container->tag(ContainerImplementationStub::class, 'foo', 'bar');
+ $container->tag(ContainerImplementationStubTwo::class, ['foo']);
$this->assertCount(1, $container->tagged('bar'));
$this->assertCount(2, $container->tagged('foo'));
- $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStub', $container->tagged('foo')[0]);
- $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStub', $container->tagged('bar')[0]);
- $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStubTwo', $container->tagged('foo')[1]);
+ $this->assertInstanceOf(ContainerImplementationStub::class, $container->tagged('foo')[0]);
+ $this->assertInstanceOf(ContainerImplementationStub::class, $container->tagged('bar')[0]);
+ $this->assertInstanceOf(ContainerImplementationStubTwo::class, $container->tagged('foo')[1]);
$container = new Container;
- $container->tag(['Illuminate\Tests\Container\ContainerImplementationStub', 'Illuminate\Tests\Container\ContainerImplementationStubTwo'], ['foo']);
+ $container->tag([ContainerImplementationStub::class, ContainerImplementationStubTwo::class], ['foo']);
$this->assertCount(2, $container->tagged('foo'));
- $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStub', $container->tagged('foo')[0]);
- $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStubTwo', $container->tagged('foo')[1]);
+ $this->assertInstanceOf(ContainerImplementationStub::class, $container->tagged('foo')[0]);
+ $this->assertInstanceOf(ContainerImplementationStubTwo::class, $container->tagged('foo')[1]);
$this->assertEmpty($container->tagged('this_tag_does_not_exist'));
}
@@ -769,10 +769,10 @@ public function testForgetInstanceForgetsInstance()
{
$container = new Container;
$containerConcreteStub = new ContainerConcreteStub;
- $container->instance('Illuminate\Tests\Container\ContainerConcreteStub', $containerConcreteStub);
- $this->assertTrue($container->isShared('Illuminate\Tests\Container\ContainerConcreteStub'));
- $container->forgetInstance('Illuminate\Tests\Container\ContainerConcreteStub');
- $this->assertFalse($container->isShared('Illuminate\Tests\Container\ContainerConcreteStub'));
+ $container->instance(ContainerConcreteStub::class, $containerConcreteStub);
+ $this->assertTrue($container->isShared(ContainerConcreteStub::class));
+ $container->forgetInstance(ContainerConcreteStub::class);
+ $this->assertFalse($container->isShared(ContainerConcreteStub::class));
}
public function testForgetInstancesForgetsAllInstances()
@@ -850,16 +850,16 @@ public function testItThrowsExceptionWhenAbstractIsSameAsAlias()
public function testContainerCanInjectSimpleVariable()
{
$container = new Container;
- $container->when('Illuminate\Tests\Container\ContainerInjectVariableStub')->needs('$something')->give(100);
- $instance = $container->make('Illuminate\Tests\Container\ContainerInjectVariableStub');
+ $container->when(ContainerInjectVariableStub::class)->needs('$something')->give(100);
+ $instance = $container->make(ContainerInjectVariableStub::class);
$this->assertEquals(100, $instance->something);
$container = new Container;
- $container->when('Illuminate\Tests\Container\ContainerInjectVariableStub')->needs('$something')->give(function ($container) {
- return $container->make('Illuminate\Tests\Container\ContainerConcreteStub');
+ $container->when(ContainerInjectVariableStub::class)->needs('$something')->give(function ($container) {
+ return $container->make(ContainerConcreteStub::class);
});
- $instance = $container->make('Illuminate\Tests\Container\ContainerInjectVariableStub');
- $this->assertInstanceOf('Illuminate\Tests\Container\ContainerConcreteStub', $instance->something);
+ $instance = $container->make(ContainerInjectVariableStub::class);
+ $this->assertInstanceOf(ContainerConcreteStub::class, $instance->something);
}
public function testContainerGetFactory()
@@ -891,19 +891,19 @@ public function testContextualBindingWorksWithAliasedTargets()
{
$container = new Container;
- $container->bind('Illuminate\Tests\Container\IContainerContractStub', 'Illuminate\Tests\Container\ContainerImplementationStub');
- $container->alias('Illuminate\Tests\Container\IContainerContractStub', 'interface-stub');
+ $container->bind(IContainerContractStub::class, ContainerImplementationStub::class);
+ $container->alias(IContainerContractStub::class, 'interface-stub');
- $container->alias('Illuminate\Tests\Container\ContainerImplementationStub', 'stub-1');
+ $container->alias(ContainerImplementationStub::class, 'stub-1');
- $container->when('Illuminate\Tests\Container\ContainerTestContextInjectOne')->needs('interface-stub')->give('stub-1');
- $container->when('Illuminate\Tests\Container\ContainerTestContextInjectTwo')->needs('interface-stub')->give('Illuminate\Tests\Container\ContainerImplementationStubTwo');
+ $container->when(ContainerTestContextInjectOne::class)->needs('interface-stub')->give('stub-1');
+ $container->when(ContainerTestContextInjectTwo::class)->needs('interface-stub')->give(ContainerImplementationStubTwo::class);
- $one = $container->make('Illuminate\Tests\Container\ContainerTestContextInjectOne');
- $two = $container->make('Illuminate\Tests\Container\ContainerTestContextInjectTwo');
+ $one = $container->make(ContainerTestContextInjectOne::class);
+ $two = $container->make(ContainerTestContextInjectTwo::class);
- $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStub', $one->impl);
- $this->assertInstanceOf('Illuminate\Tests\Container\ContainerImplementationStubTwo', $two->impl);
+ $this->assertInstanceOf(ContainerImplementationStub::class, $one->impl);
+ $this->assertInstanceOf(ContainerImplementationStubTwo::class, $two->impl);
}
public function testResolvingCallbacksShouldBeFiredWhenCalledWithAliases()
@@ -1010,15 +1010,15 @@ public function testCanBuildWithoutParameterStackWithNoConstructors()
public function testCanBuildWithoutParameterStackWithConstructors()
{
$container = new Container;
- $container->bind('Illuminate\Tests\Container\IContainerContractStub', 'Illuminate\Tests\Container\ContainerImplementationStub');
+ $container->bind(IContainerContractStub::class, ContainerImplementationStub::class);
$this->assertInstanceOf(ContainerDependentStub::class, $container->build(ContainerDependentStub::class));
}
public function testContainerKnowsEntry()
{
$container = new Container;
- $container->bind('Illuminate\Tests\Container\IContainerContractStub', 'Illuminate\Tests\Container\ContainerImplementationStub');
- $this->assertTrue($container->has('Illuminate\Tests\Container\IContainerContractStub'));
+ $container->bind(IContainerContractStub::class, ContainerImplementationStub::class);
+ $this->assertTrue($container->has(IContainerContractStub::class));
}
public function testContainerCanBindAnyWord() | false |
Other | laravel | framework | 9e987784c934b9ab012f6c9360ef40646170d7f6.json | add missing docblock (#25853) | src/Illuminate/Encryption/EncryptionServiceProvider.php | @@ -34,6 +34,8 @@ public function register()
*
* @param array $config
* @return string
+ *
+ * @throws \RuntimeException
*/
protected function key(array $config)
{ | false |
Other | laravel | framework | f0312c117ac50361edbcdc2fc2225ae67ecaa060.json | Simplify MorphOneOrMany (#25864) | src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php | @@ -67,19 +67,6 @@ public function addEagerConstraints(array $models)
$this->query->where($this->morphType, $this->morphClass);
}
- /**
- * Attach a model instance to the parent model.
- *
- * @param \Illuminate\Database\Eloquent\Model $model
- * @return \Illuminate\Database\Eloquent\Model
- */
- public function save(Model $model)
- {
- $model->setAttribute($this->getMorphType(), $this->morphClass);
-
- return parent::save($model);
- }
-
/**
* Set the foreign ID and type for creating a related model.
* | false |
Other | laravel | framework | 5e6473ecc12d9edae6c7a406b457ed08fc4611e2.json | add output to seeder (#25872) | src/Illuminate/Database/Console/Seeds/SeedCommand.php | @@ -62,6 +62,8 @@ public function handle()
Model::unguarded(function () {
$this->getSeeder()->__invoke();
});
+
+ $this->info('Database seeding completed successfully.');
}
/** | false |
Other | laravel | framework | b65cf424d6bf8f820a9ab97c02551e56dde769ff.json | fix auth (#25873) | src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php | @@ -29,6 +29,10 @@ public function actingAs(UserContract $user, $driver = null)
*/
public function be(UserContract $user, $driver = null)
{
+ if (isset($user->wasRecentlyCreated) && $user->wasRecentlyCreated) {
+ $user->wasRecentlyCreated = false;
+ }
+
$this->app['auth']->guard($driver)->setUser($user);
$this->app['auth']->shouldUse($driver); | false |
Other | laravel | framework | 54d33832ec1e9c3c0a894c941334e2a6ba6d2be6.json | Trim model class name (#25849)
When passing php class names in middleware, for example
```
->middleware('can:create, App\Models\JobDocument);
```
Developer can accidentally add a whitespace before class name.
This whitespace will cause the linked policy to not found and
cause a 403 http response. | src/Illuminate/Auth/Middleware/Authorize.php | @@ -72,7 +72,7 @@ protected function getGateArguments($request, $models)
*/
protected function getModel($request, $model)
{
- return $this->isClassName($model) ? $model : $request->route($model, $model);
+ return $this->isClassName($model) ? trim($model) : $request->route($model, $model);
}
/** | false |
Other | laravel | framework | 19e7b7b931544f89c875b1e94968ce70c7937533.json | Fix each() on BelongsToMany relationships (#25832) | src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php | @@ -673,6 +673,24 @@ public function chunk($count, callable $callback)
});
}
+ /**
+ * Execute a callback over each item while chunking.
+ *
+ * @param callable $callback
+ * @param int $count
+ * @return bool
+ */
+ public function each(callable $callback, $count = 1000)
+ {
+ return $this->chunk($count, function ($results) use ($callback) {
+ foreach ($results as $key => $value) {
+ if ($callback($value, $key) === false) {
+ return false;
+ }
+ }
+ });
+ }
+
/**
* Hydrate the pivot table relationship on the models.
* | true |
Other | laravel | framework | 19e7b7b931544f89c875b1e94968ce70c7937533.json | Fix each() on BelongsToMany relationships (#25832) | tests/Database/DatabaseEloquentIntegrationTest.php | @@ -737,6 +737,18 @@ public function testBelongsToManyRelationshipModelsAreProperlyHydratedOverChunke
});
}
+ public function testBelongsToManyRelationshipModelsAreProperlyHydratedOverEachRequest()
+ {
+ $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
+ $friend = $user->friends()->create(['email' => 'abigailotwell@gmail.com']);
+
+ EloquentTestUser::first()->friends()->each(function ($result) use ($user, $friend) {
+ $this->assertEquals('abigailotwell@gmail.com', $result->email);
+ $this->assertEquals($user->id, $result->pivot->user_id);
+ $this->assertEquals($friend->id, $result->pivot->friend_id);
+ });
+ }
+
public function testBasicHasManyEagerLoading()
{
$user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']); | true |
Other | laravel | framework | 473ffd34889673a3730456672fdba281febf0737.json | Apply fixes from StyleCI (#25841) | src/Illuminate/Http/Resources/Json/JsonResource.php | @@ -113,7 +113,7 @@ public function toArray($request)
if (is_null($this->resource)) {
return [];
}
-
+
return is_array($this->resource)
? $this->resource
: $this->resource->toArray(); | false |
Other | laravel | framework | e8dc4057c48bb2b2b7607cb4cf2b84a5e2c64db5.json | Remove variable (#25805) | src/Illuminate/Support/Collection.php | @@ -207,9 +207,7 @@ public function median($key = null)
*/
public function mode($key = null)
{
- $count = $this->count();
-
- if ($count == 0) {
+ if ($this->count() == 0) {
return;
}
| false |
Other | laravel | framework | 06118cac748d9465da4e398dd4d16c2045760c27.json | Fix assertions (#25800) | tests/Foundation/FoundationApplicationTest.php | @@ -35,7 +35,7 @@ public function testServiceProvidersAreCorrectlyRegistered()
$app = new Application;
$app->register($provider);
- $this->assertTrue(in_array($class, $app->getLoadedProviders()));
+ $this->assertArrayHasKey($class, $app->getLoadedProviders());
}
public function testClassesAreBoundWhenServiceProviderIsRegistered()
@@ -44,7 +44,7 @@ public function testClassesAreBoundWhenServiceProviderIsRegistered()
$provider = new ServiceProviderForTestingThree($app);
$app->register($provider);
- $this->assertTrue(in_array(get_class($provider), $app->getLoadedProviders()));
+ $this->assertArrayHasKey(get_class($provider), $app->getLoadedProviders());
$this->assertInstanceOf(ConcreteClass::class, $app->make(AbstractClass::class));
}
@@ -55,7 +55,7 @@ public function testSingletonsAreCreatedWhenServiceProviderIsRegistered()
$provider = new ServiceProviderForTestingThree($app);
$app->register($provider);
- $this->assertTrue(in_array(get_class($provider), $app->getLoadedProviders()));
+ $this->assertArrayHasKey(get_class($provider), $app->getLoadedProviders());
$instance = $app->make(AbstractClass::class);
@@ -70,7 +70,7 @@ public function testServiceProvidersAreCorrectlyRegisteredWhenRegisterMethodIsNo
$app = new Application;
$app->register($provider);
- $this->assertTrue(in_array($class, $app->getLoadedProviders()));
+ $this->assertArrayHasKey($class, $app->getLoadedProviders());
}
public function testDeferredServicesMarkedAsBound() | false |
Other | laravel | framework | d618cf3326468086ae9ab5ba1ee556be6182a481.json | Attach all disk attachments and not only first one | src/Illuminate/Mail/Mailable.php | @@ -381,7 +381,7 @@ protected function buildDiskAttachments($message)
FilesystemFactory::class
)->disk($attachment['disk']);
- return $message->attachData(
+ $message->attachData(
$storage->get($attachment['path']),
$attachment['name'] ?? basename($attachment['path']),
array_merge(['mime' => $storage->mimeType($attachment['path'])], $attachment['options']) | false |
Other | laravel | framework | 852ff285db8c62e64e61e7c8b88d4671cffa0736.json | Update email.blade.php (#25734) | src/Illuminate/Notifications/resources/views/email.blade.php | @@ -53,12 +53,12 @@
@component('mail::subcopy')
@lang(
"If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
- 'into your web browser: [:actionURL](:actionURL)',
+ 'into your web browser: ',
[
- 'actionText' => $actionText,
- 'actionURL' => $actionUrl
+ 'actionText' => $actionText
]
)
+[{{ $actionUrl }}]({!! $actionUrl !!})
@endcomponent
@endisset
@endcomponent | false |
Other | laravel | framework | 3c397ea1f4c7af4346f4f83144ea8d3ff307f405.json | Update email.blade.php (#25723) | src/Illuminate/Notifications/resources/views/email.blade.php | @@ -51,12 +51,12 @@
@component('mail::subcopy')
@lang(
"If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
- 'into your web browser: [:actionURL](:actionURL)',
+ 'into your web browser: ',
[
- 'actionText' => $actionText,
- 'actionURL' => $actionUrl
+ 'actionText' => $actionText
]
)
+[{{ $actionUrl }}]({!! $actionUrl !!})
@endcomponent
@endisset
@endcomponent | false |
Other | laravel | framework | f40acde14483f4f534c82cae3232fed378650664.json | Use url() instead of plain url (#25725) | src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php | @@ -469,7 +469,7 @@
@yield('message')
</p>
- <a href="/">
+ <a href="{{ url('/') }}">
<button class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
{{ __('Go Home') }}
</button> | false |
Other | laravel | framework | 23f259aeacabf532041a926e7c262789760063ea.json | Remove trailing newline from hot url (#25699) | src/Illuminate/Foundation/helpers.php | @@ -581,7 +581,7 @@ function mix($path, $manifestDirectory = '')
}
if (file_exists(public_path($manifestDirectory.'/hot'))) {
- $url = file_get_contents(public_path($manifestDirectory.'/hot'));
+ $url = rtrim(file_get_contents(public_path($manifestDirectory.'/hot')));
if (Str::startsWith($url, ['http://', 'https://'])) {
return new HtmlString(Str::after($url, ':').$path); | false |
Other | laravel | framework | 7dc3d8d35ad8bcd3b18334a44320e3162b9f6dc1.json | add callback hook for building mailable data | src/Illuminate/Mail/Mailable.php | @@ -132,6 +132,13 @@ class Mailable implements MailableContract, Renderable
*/
public $callbacks = [];
+ /**
+ * The callback that should be invoked while building the view data.
+ *
+ * @var callable
+ */
+ public static $viewDataCallback;
+
/**
* Send the message using the given mailer.
*
@@ -263,6 +270,10 @@ public function buildViewData()
{
$data = $this->viewData;
+ if (static::$viewDataCallback) {
+ $data = array_merge($data, call_user_func(static::$viewDataCallback, $this));
+ }
+
foreach ((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
if ($property->getDeclaringClass()->getName() !== self::class) {
$data[$property->getName()] = $property->getValue($this);
@@ -793,6 +804,17 @@ public function withSwiftMessage($callback)
return $this;
}
+ /**
+ * Register a callback to be called while building the view data.
+ *
+ * @param callable $callback
+ * @return void
+ */
+ public static function buildViewDataUsing(callable $callback)
+ {
+ static::$viewDataCallback = $callback;
+ }
+
/**
* Dynamically bind parameters to the message.
* | false |
Other | laravel | framework | dcf6f41c49d47b8edc90bc0249766be1a409b954.json | Fix EventTest testBuildCommand on Windows (#25646)
* Fix EventTest testBuildCommand on Windows
* Fix code style
* Fix filesystem tests on Windows
* Fix file permission tests on Windows
* Fix wrong separator in expected path on Windows
* Fix wrong quotes in expected commands on Windows | tests/Console/Scheduling/EventTest.php | @@ -15,20 +15,20 @@ public function tearDown()
public function testBuildCommand()
{
- $quote = (DIRECTORY_SEPARATOR == '\\') ? '"' : "'";
+ $isWindows = DIRECTORY_SEPARATOR == '\\';
+ $quote = ($isWindows) ? '"' : "'";
$event = new Event(m::mock('Illuminate\Console\Scheduling\Mutex'), 'php -i');
- $defaultOutput = (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null';
+ $defaultOutput = ($isWindows) ? 'NUL' : '/dev/null';
$this->assertSame("php -i > {$quote}{$defaultOutput}{$quote} 2>&1", $event->buildCommand());
- $quote = (DIRECTORY_SEPARATOR == '\\') ? '"' : "'";
-
$event = new Event(m::mock('Illuminate\Console\Scheduling\Mutex'), 'php -i');
$event->runInBackground();
- $defaultOutput = (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null';
- $this->assertSame("(php -i > {$quote}{$defaultOutput}{$quote} 2>&1 ; '".PHP_BINARY."' artisan schedule:finish \"framework/schedule-c65b1c374c37056e0c57fccb0c08d724ce6f5043\") > {$quote}{$defaultOutput}{$quote} 2>&1 &", $event->buildCommand());
+ $commandSeparator = ($isWindows ? '&' : ';');
+ $scheduleId = '"framework'.DIRECTORY_SEPARATOR.'schedule-c65b1c374c37056e0c57fccb0c08d724ce6f5043"';
+ $this->assertSame("(php -i > {$quote}{$defaultOutput}{$quote} 2>&1 {$commandSeparator} {$quote}".PHP_BINARY."{$quote} artisan schedule:finish {$scheduleId}) > {$quote}{$defaultOutput}{$quote} 2>&1 &", $event->buildCommand());
}
public function testBuildCommandSendOutputTo() | true |
Other | laravel | framework | dcf6f41c49d47b8edc90bc0249766be1a409b954.json | Fix EventTest testBuildCommand on Windows (#25646)
* Fix EventTest testBuildCommand on Windows
* Fix code style
* Fix filesystem tests on Windows
* Fix file permission tests on Windows
* Fix wrong separator in expected path on Windows
* Fix wrong quotes in expected commands on Windows | tests/Database/DatabaseMigrationRefreshCommandTest.php | @@ -35,7 +35,8 @@ public function testRefreshCommandCallsCommandsWithProperArguments()
$console->shouldReceive('find')->with('migrate:reset')->andReturn($resetCommand);
$console->shouldReceive('find')->with('migrate')->andReturn($migrateCommand);
- $resetCommand->shouldReceive('run')->with(new InputMatcher("--database --path --force 'migrate:reset'"), m::any());
+ $quote = DIRECTORY_SEPARATOR == '\\' ? '"' : "'";
+ $resetCommand->shouldReceive('run')->with(new InputMatcher("--database --path --force {$quote}migrate:reset{$quote}"), m::any());
$migrateCommand->shouldReceive('run')->with(new InputMatcher('--database --path --force migrate'), m::any());
$this->runCommand($command);
@@ -57,7 +58,8 @@ public function testRefreshCommandCallsCommandsWithStep()
$console->shouldReceive('find')->with('migrate:rollback')->andReturn($rollbackCommand);
$console->shouldReceive('find')->with('migrate')->andReturn($migrateCommand);
- $rollbackCommand->shouldReceive('run')->with(new InputMatcher("--database --path --step=2 --force 'migrate:rollback'"), m::any());
+ $quote = DIRECTORY_SEPARATOR == '\\' ? '"' : "'";
+ $rollbackCommand->shouldReceive('run')->with(new InputMatcher("--database --path --step=2 --force {$quote}migrate:rollback{$quote}"), m::any());
$migrateCommand->shouldReceive('run')->with(new InputMatcher('--database --path --force migrate'), m::any());
$this->runCommand($command, ['--step' => 2]); | true |
Other | laravel | framework | dcf6f41c49d47b8edc90bc0249766be1a409b954.json | Fix EventTest testBuildCommand on Windows (#25646)
* Fix EventTest testBuildCommand on Windows
* Fix code style
* Fix filesystem tests on Windows
* Fix file permission tests on Windows
* Fix wrong separator in expected path on Windows
* Fix wrong quotes in expected commands on Windows | tests/Database/DatabaseMigrationResetCommandTest.php | @@ -23,7 +23,7 @@ public function testResetCommandCallsMigratorWithProperArguments()
$migrator->shouldReceive('paths')->once()->andReturn([]);
$migrator->shouldReceive('setConnection')->once()->with(null);
$migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
- $migrator->shouldReceive('reset')->once()->with([__DIR__.'/migrations'], false);
+ $migrator->shouldReceive('reset')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], false);
$migrator->shouldReceive('getNotes')->andReturn([]);
$this->runCommand($command);
@@ -38,7 +38,7 @@ public function testResetCommandCanBePretended()
$migrator->shouldReceive('paths')->once()->andReturn([]);
$migrator->shouldReceive('setConnection')->once()->with('foo');
$migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
- $migrator->shouldReceive('reset')->once()->with([__DIR__.'/migrations'], true);
+ $migrator->shouldReceive('reset')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], true);
$migrator->shouldReceive('getNotes')->andReturn([]);
$this->runCommand($command, ['--pretend' => true, '--database' => 'foo']); | true |
Other | laravel | framework | dcf6f41c49d47b8edc90bc0249766be1a409b954.json | Fix EventTest testBuildCommand on Windows (#25646)
* Fix EventTest testBuildCommand on Windows
* Fix code style
* Fix filesystem tests on Windows
* Fix file permission tests on Windows
* Fix wrong separator in expected path on Windows
* Fix wrong quotes in expected commands on Windows | tests/Database/DatabaseMigrationRollbackCommandTest.php | @@ -22,7 +22,7 @@ public function testRollbackCommandCallsMigratorWithProperArguments()
$command->setLaravel($app);
$migrator->shouldReceive('paths')->once()->andReturn([]);
$migrator->shouldReceive('setConnection')->once()->with(null);
- $migrator->shouldReceive('rollback')->once()->with([__DIR__.'/migrations'], ['pretend' => false, 'step' => 0]);
+ $migrator->shouldReceive('rollback')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], ['pretend' => false, 'step' => 0]);
$migrator->shouldReceive('getNotes')->andReturn([]);
$this->runCommand($command);
@@ -36,7 +36,7 @@ public function testRollbackCommandCallsMigratorWithStepOption()
$command->setLaravel($app);
$migrator->shouldReceive('paths')->once()->andReturn([]);
$migrator->shouldReceive('setConnection')->once()->with(null);
- $migrator->shouldReceive('rollback')->once()->with([__DIR__.'/migrations'], ['pretend' => false, 'step' => 2]);
+ $migrator->shouldReceive('rollback')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], ['pretend' => false, 'step' => 2]);
$migrator->shouldReceive('getNotes')->andReturn([]);
$this->runCommand($command, ['--step' => 2]);
@@ -50,7 +50,7 @@ public function testRollbackCommandCanBePretended()
$command->setLaravel($app);
$migrator->shouldReceive('paths')->once()->andReturn([]);
$migrator->shouldReceive('setConnection')->once()->with('foo');
- $migrator->shouldReceive('rollback')->once()->with([__DIR__.'/migrations'], true);
+ $migrator->shouldReceive('rollback')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], true);
$migrator->shouldReceive('getNotes')->andReturn([]);
$this->runCommand($command, ['--pretend' => true, '--database' => 'foo']);
@@ -64,7 +64,7 @@ public function testRollbackCommandCanBePretendedWithStepOption()
$command->setLaravel($app);
$migrator->shouldReceive('paths')->once()->andReturn([]);
$migrator->shouldReceive('setConnection')->once()->with('foo');
- $migrator->shouldReceive('rollback')->once()->with([__DIR__.'/migrations'], ['pretend' => true, 'step' => 2]);
+ $migrator->shouldReceive('rollback')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], ['pretend' => true, 'step' => 2]);
$migrator->shouldReceive('getNotes')->andReturn([]);
$this->runCommand($command, ['--pretend' => true, '--database' => 'foo', '--step' => 2]); | true |
Other | laravel | framework | dcf6f41c49d47b8edc90bc0249766be1a409b954.json | Fix EventTest testBuildCommand on Windows (#25646)
* Fix EventTest testBuildCommand on Windows
* Fix code style
* Fix filesystem tests on Windows
* Fix file permission tests on Windows
* Fix wrong separator in expected path on Windows
* Fix wrong quotes in expected commands on Windows | tests/Filesystem/FilesystemAdapterTest.php | @@ -61,7 +61,7 @@ public function testPath()
{
$this->filesystem->write('file.txt', 'Hello World');
$filesystemAdapter = new FilesystemAdapter($this->filesystem);
- $this->assertEquals($this->tempDir.'/file.txt', $filesystemAdapter->path('file.txt'));
+ $this->assertEquals($this->tempDir.DIRECTORY_SEPARATOR.'file.txt', $filesystemAdapter->path('file.txt'));
}
public function testGet()
@@ -90,15 +90,15 @@ public function testPrepend()
file_put_contents($this->tempDir.'/file.txt', 'World');
$filesystemAdapter = new FilesystemAdapter($this->filesystem);
$filesystemAdapter->prepend('file.txt', 'Hello ');
- $this->assertStringEqualsFile($this->tempDir.'/file.txt', "Hello \nWorld");
+ $this->assertStringEqualsFile($this->tempDir.'/file.txt', 'Hello '.PHP_EOL.'World');
}
public function testAppend()
{
file_put_contents($this->tempDir.'/file.txt', 'Hello ');
$filesystemAdapter = new FilesystemAdapter($this->filesystem);
$filesystemAdapter->append('file.txt', 'Moon');
- $this->assertStringEqualsFile($this->tempDir.'/file.txt', "Hello \nMoon");
+ $this->assertStringEqualsFile($this->tempDir.'/file.txt', 'Hello '.PHP_EOL.'Moon');
}
public function testDelete() | true |
Other | laravel | framework | dcf6f41c49d47b8edc90bc0249766be1a409b954.json | Fix EventTest testBuildCommand on Windows (#25646)
* Fix EventTest testBuildCommand on Windows
* Fix code style
* Fix filesystem tests on Windows
* Fix file permission tests on Windows
* Fix wrong separator in expected path on Windows
* Fix wrong quotes in expected commands on Windows | tests/Filesystem/FilesystemTest.php | @@ -47,7 +47,8 @@ public function testSetChmod()
$files = new Filesystem;
$files->chmod($this->tempDir.'/file.txt', 0755);
$filePermission = substr(sprintf('%o', fileperms($this->tempDir.'/file.txt')), -4);
- $this->assertEquals('0755', $filePermission);
+ $expectedPermissions = DIRECTORY_SEPARATOR == '\\' ? '0666' : '0755';
+ $this->assertEquals($expectedPermissions, $filePermission);
}
public function testGetChmod()
@@ -56,8 +57,9 @@ public function testGetChmod()
chmod($this->tempDir.'/file.txt', 0755);
$files = new Filesystem;
- $filePermisson = $files->chmod($this->tempDir.'/file.txt');
- $this->assertEquals('0755', $filePermisson);
+ $filePermission = $files->chmod($this->tempDir.'/file.txt');
+ $expectedPermissions = DIRECTORY_SEPARATOR == '\\' ? '0666' : '0755';
+ $this->assertEquals($expectedPermissions, $filePermission);
}
public function testDeleteRemovesFiles() | true |
Other | laravel | framework | 94f0c26186b3df2f34ac71767a75a0cb100bc823.json | Fix little typo in test function name (#25595) | tests/Database/DatabaseEloquentBuilderTest.php | @@ -362,7 +362,7 @@ public function testPluckReturnsTheDateAttributesOfAModel()
$this->assertEquals(['date_2010-01-01 00:00:00', 'date_2011-01-01 00:00:00'], $builder->pluck('created_at')->all());
}
- public function testPluckWithoutModelGetterJustReturnTheAttributesFoundInDatabase()
+ public function testPluckWithoutModelGetterJustReturnsTheAttributesFoundInDatabase()
{
$builder = $this->getBuilder();
$builder->getQuery()->shouldReceive('pluck')->with('name', '')->andReturn(new BaseCollection(['bar', 'baz'])); | false |
Other | laravel | framework | ef681e23923540ddc9021af8b1e8c075faebaace.json | Handle Carbon 2 tests | tests/Support/DateFacadeTest.php | @@ -78,7 +78,7 @@ public function testCarbonImmutable()
'locale' => 'fr',
]));
$this->assertSame('fr', Date::now()->locale);
- Date::swap(null);
+ Date::swap(Carbon::class);
$this->assertSame('en', Date::now()->locale);
include_once __DIR__.'/fixtures/CustomDateClass.php';
Date::swap(\CustomDateClass::class); | true |
Other | laravel | framework | ef681e23923540ddc9021af8b1e8c075faebaace.json | Handle Carbon 2 tests | tests/Support/SupportCarbonTest.php | @@ -4,6 +4,7 @@
use DateTime;
use DateTimeInterface;
+use Carbon\CarbonImmutable;
use Illuminate\Support\Carbon;
use PHPUnit\Framework\TestCase;
use Carbon\Carbon as BaseCarbon;
@@ -87,7 +88,7 @@ public function testCarbonAllowsCustomSerializer()
public function testCarbonCanSerializeToJson()
{
- $this->assertSame([
+ $this->assertSame(class_exists(CarbonImmutable::class) ? '2017-06-27T13:14:15.000000Z' : [
'date' => '2017-06-27 13:14:15.000000',
'timezone_type' => 3,
'timezone' => 'UTC', | true |
Other | laravel | framework | ac42a58f42dbbd25afa1eceb32db8c3334c04bfe.json | Prevent command double calling | src/Illuminate/Foundation/Testing/PendingCommand.php | @@ -47,6 +47,13 @@ class PendingCommand
*/
protected $expectedExitCode;
+ /**
+ * Determine if command was called.
+ *
+ * @var bool
+ */
+ private $isCalled = false;
+
/**
* Create a new pending console command run.
*
@@ -111,6 +118,8 @@ public function assertExitCode($exitCode)
*/
public function callNow()
{
+ $this->isCalled = true;
+
return $this->app[Kernel::class]->call($this->command, $this->parameters);
}
@@ -175,6 +184,10 @@ private function createABufferedOutputMock()
*/
public function __destruct()
{
+ if ($this->isCalled) {
+ return;
+ }
+
$this->mockConsoleOutput();
try { | false |
Other | laravel | framework | 70a72fcac9d8852fc1a4ce11eb47842774c11876.json | add storeOutput method | src/Illuminate/Console/Scheduling/Event.php | @@ -338,6 +338,18 @@ public function filtersPass($app)
return true;
}
+ /**
+ * Ensure that the output is stored on disk in a log file.
+ *
+ * @return $this
+ */
+ public function storeOutput()
+ {
+ $this->ensureOutputIsBeingCaptured();
+
+ return $this;
+ }
+
/**
* Send the output of the command to a given location.
* | false |
Other | laravel | framework | f12df3e2061707720671327ef67decd364b0184e.json | Remove unused view tests (#25551) | tests/View/ViewBladeCompilerTest.php | @@ -96,16 +96,4 @@ protected function getFiles()
{
return m::mock('Illuminate\Filesystem\Filesystem');
}
-
- public function testGetTagsProvider()
- {
- return [
- ['{{', '}}'],
- ['{{{', '}}}'],
- ['[[', ']]'],
- ['[[[', ']]]'],
- ['((', '))'],
- ['(((', ')))'],
- ];
- }
} | false |
Other | laravel | framework | b37b7caa6e74e01da76ca403796835156fe0304e.json | Add options array | src/Illuminate/Mail/TransportManager.php | @@ -77,9 +77,10 @@ protected function createSesDriver()
'version' => 'latest', 'service' => 'email',
]);
- return new SesTransport(new SesClient(
- $this->addSesCredentials($config)
- ));
+ return new SesTransport(
+ new SesClient($this->addSesCredentials($config)),
+ $config['options'] ?? []
+ );
}
/** | false |
Other | laravel | framework | e21b17fd277b9a2424ea2b3f727325d1df65c713.json | Add options for SES’s sendRawEmail | src/Illuminate/Mail/Transport/SesTransport.php | @@ -14,15 +14,24 @@ class SesTransport extends Transport
*/
protected $ses;
+ /**
+ * Transmission options.
+ *
+ * @var array
+ */
+ protected $options = [];
+
/**
* Create a new SES transport instance.
*
* @param \Aws\Ses\SesClient $ses
+ * @param array $options
* @return void
*/
- public function __construct(SesClient $ses)
+ public function __construct(SesClient $ses, $options = [])
{
$this->ses = $ses;
+ $this->options = $options;
}
/**
@@ -32,17 +41,43 @@ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = nul
{
$this->beforeSendPerformed($message);
- $headers = $message->getHeaders();
+ $result = $this->ses->sendRawEmail(
+ array_merge(
+ $this->options,
+ [
+ 'Source' => key($message->getSender() ?: $message->getFrom()),
+ 'RawMessage' => [
+ 'Data' => $message->toString(),
+ ],
+ ]
+ )
+ );
- $headers->addTextHeader('X-SES-Message-ID', $this->ses->sendRawEmail([
- 'Source' => key($message->getSender() ?: $message->getFrom()),
- 'RawMessage' => [
- 'Data' => $message->toString(),
- ],
- ])->get('MessageId'));
+ $message->getHeaders()->addTextHeader('X-SES-Message-ID', $result->get('MessageId'));
$this->sendPerformed($message);
return $this->numberOfRecipients($message);
}
+
+ /**
+ * Get the transmission options being used by the transport.
+ *
+ * @return array
+ */
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ /**
+ * Set the transmission options being used by the transport.
+ *
+ * @param array $options
+ * @return array
+ */
+ public function setOptions(array $options)
+ {
+ return $this->options = $options;
+ }
} | false |
Other | laravel | framework | a8cf7f4b82762b4738f605e04da637227c7de5a8.json | Add test for the Model push method (#25519) | tests/Integration/Database/EloquentPushTest.php | @@ -0,0 +1,90 @@
+<?php
+
+namespace Illuminate\Tests\Integration\Database;
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Schema\Blueprint;
+
+/**
+ * @group integration
+ */
+class EloquentPushTest extends DatabaseTestCase
+{
+ public function setUp()
+ {
+ parent::setUp();
+
+ Schema::create('users', function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('name');
+ });
+
+ Schema::create('posts', function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('title');
+ $table->unsignedInteger('user_id');
+ });
+
+ Schema::create('comments', function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('comment');
+ $table->unsignedInteger('post_id');
+ });
+ }
+
+ public function testPushMethodSavesTheRelationshipsRecursively()
+ {
+ $user = new UserX();
+ $user->name = 'Test';
+ $user->save();
+ $user->posts()->create(['title' => 'Test title']);
+
+ $post = PostX::firstOrFail();
+ $post->comments()->create(['comment' => 'Test comment']);
+
+ $user = $user->fresh();
+ $user->name = 'Test 1';
+ $user->posts[0]->title = 'Test title 1';
+ $user->posts[0]->comments[0]->comment = 'Test comment 1';
+ $user->push();
+
+ $this->assertSame(1, UserX::count());
+ $this->assertSame('Test 1', UserX::firstOrFail()->name);
+ $this->assertSame(1, PostX::count());
+ $this->assertSame('Test title 1', PostX::firstOrFail()->title);
+ $this->assertSame(1, CommentX::count());
+ $this->assertSame('Test comment 1', CommentX::firstOrFail()->comment);
+ }
+}
+
+class UserX extends Model
+{
+ public $timestamps = false;
+ protected $guarded = [];
+ protected $table = 'users';
+
+ public function posts()
+ {
+ return $this->hasMany(PostX::class, 'user_id');
+ }
+}
+
+class PostX extends Model
+{
+ public $timestamps = false;
+ protected $guarded = [];
+ protected $table = 'posts';
+
+ public function comments()
+ {
+ return $this->hasMany(CommentX::class, 'post_id');
+ }
+}
+
+class CommentX extends Model
+{
+ public $timestamps = false;
+ protected $guarded = [];
+ protected $table = 'comments';
+} | false |
Other | laravel | framework | 1ac97b810cc502c71d7f6ae9d08a7f0b010c9ed3.json | Apply StyleCI fixes. | tests/Validation/ValidationValidatorTest.php | @@ -1540,7 +1540,7 @@ public function testValidateGtPlaceHolderIsReplacedProperly()
'validation.gt.numeric' => ':value',
'validation.gt.string' => ':value',
'validation.gt.file' => ':value',
- 'validation.gt.array' => ':value'
+ 'validation.gt.array' => ':value',
], 'en');
$v = new Validator($trans, ['items' => '3'], ['items' => 'gt:4']);
@@ -1565,7 +1565,7 @@ public function testValidateGtPlaceHolderIsReplacedProperly()
$this->assertFalse($v->passes());
$this->assertEquals(5, $v->messages()->first('photo'));
- $v = new Validator($trans, ['items' => [1,2,3], 'more' => [0,1,2,3]], ['items' => 'gt:more']);
+ $v = new Validator($trans, ['items' => [1, 2, 3], 'more' => [0, 1, 2, 3]], ['items' => 'gt:more']);
$this->assertFalse($v->passes());
$this->assertEquals(4, $v->messages()->first('items'));
}
@@ -1577,7 +1577,7 @@ public function testValidateLtPlaceHolderIsReplacedProperly()
'validation.lt.numeric' => ':value',
'validation.lt.string' => ':value',
'validation.lt.file' => ':value',
- 'validation.lt.array' => ':value'
+ 'validation.lt.array' => ':value',
], 'en');
$v = new Validator($trans, ['items' => '3'], ['items' => 'lt:2']);
@@ -1602,7 +1602,7 @@ public function testValidateLtPlaceHolderIsReplacedProperly()
$this->assertFalse($v->passes());
$this->assertEquals(2, $v->messages()->first('photo'));
- $v = new Validator($trans, ['items' => [1,2,3], 'less' => [0,1]], ['items' => 'lt:less']);
+ $v = new Validator($trans, ['items' => [1, 2, 3], 'less' => [0, 1]], ['items' => 'lt:less']);
$this->assertFalse($v->passes());
$this->assertEquals(2, $v->messages()->first('items'));
}
@@ -1614,7 +1614,7 @@ public function testValidateGtePlaceHolderIsReplacedProperly()
'validation.gte.numeric' => ':value',
'validation.gte.string' => ':value',
'validation.gte.file' => ':value',
- 'validation.gte.array' => ':value'
+ 'validation.gte.array' => ':value',
], 'en');
$v = new Validator($trans, ['items' => '3'], ['items' => 'gte:4']);
@@ -1639,7 +1639,7 @@ public function testValidateGtePlaceHolderIsReplacedProperly()
$this->assertFalse($v->passes());
$this->assertEquals(5, $v->messages()->first('photo'));
- $v = new Validator($trans, ['items' => [1,2,3], 'more' => [0,1,2,3]], ['items' => 'gte:more']);
+ $v = new Validator($trans, ['items' => [1, 2, 3], 'more' => [0, 1, 2, 3]], ['items' => 'gte:more']);
$this->assertFalse($v->passes());
$this->assertEquals(4, $v->messages()->first('items'));
}
@@ -1651,7 +1651,7 @@ public function testValidateLtePlaceHolderIsReplacedProperly()
'validation.lte.numeric' => ':value',
'validation.lte.string' => ':value',
'validation.lte.file' => ':value',
- 'validation.lte.array' => ':value'
+ 'validation.lte.array' => ':value',
], 'en');
$v = new Validator($trans, ['items' => '3'], ['items' => 'lte:2']);
@@ -1676,7 +1676,7 @@ public function testValidateLtePlaceHolderIsReplacedProperly()
$this->assertFalse($v->passes());
$this->assertEquals(2, $v->messages()->first('photo'));
- $v = new Validator($trans, ['items' => [1,2,3], 'less' => [0,1]], ['items' => 'lte:less']);
+ $v = new Validator($trans, ['items' => [1, 2, 3], 'less' => [0, 1]], ['items' => 'lte:less']);
$this->assertFalse($v->passes());
$this->assertEquals(2, $v->messages()->first('items'));
} | false |
Other | laravel | framework | deeb649e07fdffae98c68f3b5753a64ec0fda537.json | remove getDefaultNamespace method (#25510) | src/Illuminate/Foundation/Console/ModelMakeCommand.php | @@ -125,17 +125,6 @@ protected function getStub()
return __DIR__.'/stubs/model.stub';
}
- /**
- * Get the default namespace for the class.
- *
- * @param string $rootNamespace
- * @return string
- */
- protected function getDefaultNamespace($rootNamespace)
- {
- return $rootNamespace;
- }
-
/**
* Get the console command options.
* | false |
Other | laravel | framework | eaac77bfb878b49f2ceff4fb09198e437d38683d.json | fix bug with invokables | src/Illuminate/Console/Scheduling/CallbackEvent.php | @@ -71,7 +71,9 @@ public function run(Container $container)
parent::callBeforeCallbacks($container);
try {
- $response = $container->call($this->callback, $this->parameters);
+ $response = is_object($this->callback)
+ ? $container->call([$this->callback, '__invoke'], $this->parameters)
+ : $container->call($this->callback, $this->parameters);
} finally {
$this->removeMutex();
| false |
Other | laravel | framework | 22cdcf7cd02a6e35146b4737321a7ce18a075d43.json | Apply fixes from StyleCI (#25489) | tests/Integration/Console/ConsoleApplicationTest.php | @@ -5,7 +5,6 @@
use Illuminate\Console\Command;
use Orchestra\Testbench\TestCase;
use Illuminate\Contracts\Console\Kernel;
-use Illuminate\Foundation\Testing\PendingCommand;
class ConsoleApplicationTest extends TestCase
{ | false |
Other | laravel | framework | 97b6deec70ed6592b529b29f13c1b10a05c2be5c.json | add missing docblock (#25477) | src/Illuminate/Routing/Console/ControllerMakeCommand.php | @@ -150,6 +150,8 @@ protected function buildModelReplacements(array $replace)
*
* @param string $model
* @return string
+ *
+ * @throws \InvalidArgumentException
*/
protected function parseModel($model)
{ | false |
Other | laravel | framework | 327d5d6410b1c9c392393808428da003710f45f1.json | Add missing docblock. (#25486) | src/Illuminate/Mail/Transport/MailgunTransport.php | @@ -41,6 +41,7 @@ class MailgunTransport extends Transport
* @param \GuzzleHttp\ClientInterface $client
* @param string $key
* @param string $domain
+ * @param string|null $endpoint
* @return void
*/
public function __construct(ClientInterface $client, $key, $domain, $endpoint = null) | false |
Other | laravel | framework | 7aeff1d4393afba36c52e301726d848e2a373b12.json | Add the ability to skip algorithm checking | src/Illuminate/Hashing/Argon2IdHasher.php | @@ -16,7 +16,7 @@ class Argon2IdHasher extends ArgonHasher
*/
public function check($value, $hashedValue, array $options = [])
{
- if ($this->info($hashedValue)['algoName'] !== 'argon2id') {
+ if ($this->verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'argon2id') {
throw new RuntimeException('This password does not use the Argon2id algorithm.');
}
| true |
Other | laravel | framework | 7aeff1d4393afba36c52e301726d848e2a373b12.json | Add the ability to skip algorithm checking | src/Illuminate/Hashing/ArgonHasher.php | @@ -28,6 +28,13 @@ class ArgonHasher extends AbstractHasher implements HasherContract
*/
protected $threads = 2;
+ /**
+ * Indicates whether to perform an algorithm check.
+ *
+ * @var bool
+ */
+ protected $verifyAlgorithm = true;
+
/**
* Create a new hasher instance.
*
@@ -39,6 +46,7 @@ public function __construct(array $options = [])
$this->time = $options['time'] ?? $this->time;
$this->memory = $options['memory'] ?? $this->memory;
$this->threads = $options['threads'] ?? $this->threads;
+ $this->verifyAlgorithm = $options['verifyAlgorithm'] ?? $this->verifyAlgorithm;
}
/**
@@ -85,7 +93,7 @@ protected function algorithm()
*/
public function check($value, $hashedValue, array $options = [])
{
- if ($this->info($hashedValue)['algoName'] !== 'argon2i') {
+ if ($this->verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'argon2i') {
throw new RuntimeException('This password does not use the Argon2i algorithm.');
}
| true |
Other | laravel | framework | 7aeff1d4393afba36c52e301726d848e2a373b12.json | Add the ability to skip algorithm checking | src/Illuminate/Hashing/BcryptHasher.php | @@ -14,6 +14,13 @@ class BcryptHasher extends AbstractHasher implements HasherContract
*/
protected $rounds = 10;
+ /**
+ * Indicates whether to perform an algorithm check.
+ *
+ * @var bool
+ */
+ protected $verifyAlgorithm = true;
+
/**
* Create a new hasher instance.
*
@@ -23,6 +30,7 @@ class BcryptHasher extends AbstractHasher implements HasherContract
public function __construct(array $options = [])
{
$this->rounds = $options['rounds'] ?? $this->rounds;
+ $this->verifyAlgorithm = $options['verify_algorithm'] ?? $this->verifyAlgorithm;
}
/**
@@ -57,7 +65,7 @@ public function make($value, array $options = [])
*/
public function check($value, $hashedValue, array $options = [])
{
- if ($this->info($hashedValue)['algoName'] !== 'bcrypt') {
+ if ($this->verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'bcrypt') {
throw new RuntimeException('This password does not use the Bcrypt algorithm.');
}
| true |
Other | laravel | framework | 6b207dfe4ce5e66be9638e02b8d2be9f190e823c.json | Add Test suffix to misnamed tests (#25471) | tests/Database/DatabaseEloquentCastsDatabaseStringTest.php | @@ -6,7 +6,7 @@
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
-class DatabaseEloquentCastsDatabaseString extends TestCase
+class DatabaseEloquentCastsDatabaseStringTest extends TestCase
{
public function setUp()
{ | true |
Other | laravel | framework | 6b207dfe4ce5e66be9638e02b8d2be9f190e823c.json | Add Test suffix to misnamed tests (#25471) | tests/Database/DatabaseEloquentTimestampsTest.php | @@ -7,7 +7,7 @@
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Eloquent\Model as Eloquent;
-class DatabaseEloquentTimestamps extends TestCase
+class DatabaseEloquentTimestampsTest extends TestCase
{
public function setUp()
{ | true |
Other | laravel | framework | 61396302621d3391721094c71b5fb75860c97bb4.json | Add getStreamedContent to TestResponse class | src/Illuminate/Foundation/Testing/TestResponse.php | @@ -9,6 +9,7 @@
use Illuminate\Contracts\View\View;
use Illuminate\Support\Traits\Macroable;
use PHPUnit\Framework\Assert as PHPUnit;
+use Symfony\Component\HttpFoundation\StreamedResponse;
use Illuminate\Foundation\Testing\Constraints\SeeInOrder;
/**
@@ -27,6 +28,13 @@ class TestResponse
*/
public $baseResponse;
+ /**
+ * The streamed content of the response.
+ *
+ * @var string
+ */
+ protected $streamedContent;
+
/**
* Create a new test response instance.
*
@@ -949,6 +957,28 @@ public function dump()
dd($content);
}
+ /**
+ * Get the streamed content from the response.
+ *
+ * @return string
+ */
+ public function getStreamedContent()
+ {
+ if (! is_null($this->streamedContent)) {
+ return $this->streamedContent;
+ }
+
+ if (! $this->baseResponse instanceof StreamedResponse) {
+ PHPUnit::fail('The response is not a streamed response.');
+ }
+
+ ob_start();
+
+ $this->sendContent();
+
+ return $this->streamedContent = ob_get_clean();
+ }
+
/**
* Dynamically access base response parameters.
* | false |
Other | laravel | framework | 4e84bdcdffcdb05f5b008456a8c77d5d64233c60.json | Apply fixes from StyleCI (#25462) | src/Illuminate/Auth/MustVerifyEmail.php | @@ -22,7 +22,7 @@ public function hasVerifiedEmail()
public function markEmailAsVerified()
{
return $this->forceFill([
- 'email_verified_at' => $this->freshTimestamp()
+ 'email_verified_at' => $this->freshTimestamp(),
])->save();
}
| false |
Other | laravel | framework | 045cbfd95c611928aef1b877d1a3dc60d5f19580.json | Send an event when the user's email is verified
Upon user email verification we may like to take certain immediate actions. For example, once we have verified that the user has a valid email from a certain company domain, we may assign a role automatically. | src/Illuminate/Auth/Events/Verified.php | @@ -0,0 +1,28 @@
+<?php
+
+namespace Illuminate\Auth\Events;
+
+use Illuminate\Queue\SerializesModels;
+
+class Verified
+{
+ use SerializesModels;
+
+ /**
+ * The verified user.
+ *
+ * @var \Illuminate\Contracts\Auth\MustVerifyEmail
+ */
+ public $user;
+
+ /**
+ * Create a new event instance.
+ *
+ * @param \Illuminate\Contracts\Auth\MustVerifyEmail $user
+ * @return void
+ */
+ public function __construct($user)
+ {
+ $this->user = $user;
+ }
+} | true |
Other | laravel | framework | 045cbfd95c611928aef1b877d1a3dc60d5f19580.json | Send an event when the user's email is verified
Upon user email verification we may like to take certain immediate actions. For example, once we have verified that the user has a valid email from a certain company domain, we may assign a role automatically. | src/Illuminate/Auth/MustVerifyEmail.php | @@ -17,11 +17,11 @@ public function hasVerifiedEmail()
/**
* Mark the given user's email as verified.
*
- * @return void
+ * @return bool
*/
public function markEmailAsVerified()
{
- $this->forceFill(['email_verified_at' => $this->freshTimestamp()])->save();
+ return $this->forceFill(['email_verified_at' => $this->freshTimestamp()])->save();
}
/** | true |
Other | laravel | framework | 045cbfd95c611928aef1b877d1a3dc60d5f19580.json | Send an event when the user's email is verified
Upon user email verification we may like to take certain immediate actions. For example, once we have verified that the user has a valid email from a certain company domain, we may assign a role automatically. | src/Illuminate/Foundation/Auth/VerifiesEmails.php | @@ -2,6 +2,7 @@
namespace Illuminate\Foundation\Auth;
+use Illuminate\Auth\Events\Verified;
use Illuminate\Http\Request;
trait VerifiesEmails
@@ -30,7 +31,9 @@ public function show(Request $request)
public function verify(Request $request)
{
if ($request->route('id') == $request->user()->getKey()) {
- $request->user()->markEmailAsVerified();
+ if ($request->user()->markEmailAsVerified()) {
+ event(new Verified($request->user()));
+ }
}
return redirect($this->redirectPath()); | true |
Other | laravel | framework | b3fe47783d2a0bd6557c1744c3d711cd73c7198c.json | Show maintenance message on error page (#25431) | src/Illuminate/Foundation/Exceptions/views/503.blade.php | @@ -8,4 +8,4 @@
</div>
@endsection
-@section('message', __('Sorry, we are doing some maintenance. Please check back soon.'))
+@section('message', __($exception->getMessage() ?: 'Sorry, we are doing some maintenance. Please check back soon.')) | false |
Other | laravel | framework | a8c505652b24ee7ca695033737ca7a992e750ac6.json | Fix nullable MorphTo and $touches | src/Illuminate/Database/Eloquent/Relations/MorphTo.php | @@ -223,6 +223,21 @@ public function dissociate()
return $this->parent->setRelation($this->relation, null);
}
+ /**
+ * Touch all of the related models for the relationship.
+ *
+ * @return void
+ */
+ public function touch()
+ {
+ // If there is no related model, we'll just return to prevent an invalid query.
+ if (is_null($this->ownerKey)) {
+ return;
+ }
+
+ parent::touch();
+ }
+
/**
* Remove all or passed registered global scopes.
* | true |
Other | laravel | framework | a8c505652b24ee7ca695033737ca7a992e750ac6.json | Fix nullable MorphTo and $touches | tests/Integration/Database/EloquentMorphToTouchesTest.php | @@ -0,0 +1,67 @@
+<?php
+
+namespace Illuminate\Tests\Integration\Database\EloquentMorphToTouchesTest;
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Tests\Integration\Database\DatabaseTestCase;
+
+/**
+ * @group integration
+ */
+class EloquentMorphToTouchesTest extends DatabaseTestCase
+{
+ public function setUp()
+ {
+ parent::setUp();
+
+ Schema::create('posts', function (Blueprint $table) {
+ $table->increments('id');
+ $table->timestamps();
+ });
+
+ Schema::create('comments', function (Blueprint $table) {
+ $table->increments('id');
+ $table->nullableMorphs('commentable');
+ });
+
+ Post::create();
+ }
+
+ public function test_not_null()
+ {
+ $comment = (new Comment)->commentable()->associate(Post::first());
+
+ \DB::enableQueryLog();
+
+ $comment->save();
+
+ $this->assertCount(2, \DB::getQueryLog());
+ }
+
+ public function test_null()
+ {
+ \DB::enableQueryLog();
+
+ Comment::create();
+
+ $this->assertCount(1, \DB::getQueryLog());
+ }
+}
+
+class Comment extends Model
+{
+ public $timestamps = false;
+
+ protected $touches = ['commentable'];
+
+ public function commentable()
+ {
+ return $this->morphTo();
+ }
+}
+
+class Post extends Model
+{
+} | true |
Other | laravel | framework | 40ccbc3497198333d3c75c51729d94bb32c77d0d.json | Pass authorization by default (#25417) | src/Illuminate/Foundation/Http/FormRequest.php | @@ -150,7 +150,7 @@ protected function passesAuthorization()
return $this->container->call([$this, 'authorize']);
}
- return false;
+ return true;
}
/** | false |
Other | laravel | framework | c074c11bf172e44c5dd2e7acf753f7c1da8efca1.json | Use 4 spaces in views (#25418) | src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php | @@ -1,485 +1,485 @@
<!doctype html>
<html lang="en">
- <head>
- <title>@yield('title')</title>
-
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-
- <!-- Fonts -->
- <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">
-
- <!-- Styles -->
- <style>
- html {
- line-height: 1.15;
- -ms-text-size-adjust: 100%;
- -webkit-text-size-adjust: 100%;
- }
-
- body {
- margin: 0;
- }
-
- header,
- nav,
- section {
- display: block;
- }
-
- figcaption,
- main {
- display: block;
- }
-
- a {
- background-color: transparent;
- -webkit-text-decoration-skip: objects;
- }
-
- strong {
- font-weight: inherit;
- }
-
- strong {
- font-weight: bolder;
- }
-
- code {
- font-family: monospace, monospace;
- font-size: 1em;
- }
-
- dfn {
- font-style: italic;
- }
-
- svg:not(:root) {
- overflow: hidden;
- }
-
- button,
- input {
- font-family: sans-serif;
- font-size: 100%;
- line-height: 1.15;
- margin: 0;
- }
-
- button,
- input {
- overflow: visible;
- }
-
- button {
- text-transform: none;
- }
-
- button,
- html [type="button"],
- [type="reset"],
- [type="submit"] {
- -webkit-appearance: button;
- }
-
- button::-moz-focus-inner,
- [type="button"]::-moz-focus-inner,
- [type="reset"]::-moz-focus-inner,
- [type="submit"]::-moz-focus-inner {
- border-style: none;
- padding: 0;
- }
-
- button:-moz-focusring,
- [type="button"]:-moz-focusring,
- [type="reset"]:-moz-focusring,
- [type="submit"]:-moz-focusring {
- outline: 1px dotted ButtonText;
- }
-
- legend {
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- color: inherit;
- display: table;
- max-width: 100%;
- padding: 0;
- white-space: normal;
- }
-
- [type="checkbox"],
- [type="radio"] {
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- padding: 0;
- }
-
- [type="number"]::-webkit-inner-spin-button,
- [type="number"]::-webkit-outer-spin-button {
- height: auto;
- }
-
- [type="search"] {
- -webkit-appearance: textfield;
- outline-offset: -2px;
- }
-
- [type="search"]::-webkit-search-cancel-button,
- [type="search"]::-webkit-search-decoration {
- -webkit-appearance: none;
- }
-
- ::-webkit-file-upload-button {
- -webkit-appearance: button;
- font: inherit;
- }
-
- menu {
- display: block;
- }
-
- canvas {
- display: inline-block;
- }
-
- template {
- display: none;
- }
-
- [hidden] {
- display: none;
- }
-
- html {
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- font-family: sans-serif;
- }
-
- *,
- *::before,
- *::after {
- -webkit-box-sizing: inherit;
- box-sizing: inherit;
- }
-
- p {
- margin: 0;
- }
-
- button {
- background: transparent;
- padding: 0;
- }
-
- button:focus {
- outline: 1px dotted;
- outline: 5px auto -webkit-focus-ring-color;
- }
-
- *,
- *::before,
- *::after {
- border-width: 0;
- border-style: solid;
- border-color: #dae1e7;
- }
-
- button,
- [type="button"],
- [type="reset"],
- [type="submit"] {
- border-radius: 0;
- }
-
- button,
- input {
- font-family: inherit;
- }
-
- input::-webkit-input-placeholder {
- color: inherit;
- opacity: .5;
- }
-
- input:-ms-input-placeholder {
- color: inherit;
- opacity: .5;
- }
-
- input::-ms-input-placeholder {
- color: inherit;
- opacity: .5;
- }
-
- input::placeholder {
- color: inherit;
- opacity: .5;
- }
-
- button,
- [role=button] {
- cursor: pointer;
- }
-
- .bg-transparent {
- background-color: transparent;
- }
-
- .bg-white {
- background-color: #fff;
- }
-
- .bg-teal-light {
- background-color: #64d5ca;
- }
-
- .bg-blue-dark {
- background-color: #2779bd;
- }
-
- .bg-indigo-light {
- background-color: #7886d7;
- }
-
- .bg-purple-light {
- background-color: #a779e9;
- }
-
- .bg-no-repeat {
- background-repeat: no-repeat;
- }
-
- .bg-cover {
- background-size: cover;
- }
-
- .border-grey-light {
- border-color: #dae1e7;
- }
-
- .hover\:border-grey:hover {
- border-color: #b8c2cc;
- }
-
- .rounded-lg {
- border-radius: .5rem;
- }
-
- .border-2 {
- border-width: 2px;
- }
-
- .hidden {
- display: none;
- }
-
- .flex {
- display: -webkit-box;
- display: -ms-flexbox;
- display: flex;
- }
-
- .items-center {
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- }
-
- .justify-center {
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- justify-content: center;
- }
-
- .font-sans {
- font-family: Nunito, sans-serif;
- }
-
- .font-light {
- font-weight: 300;
- }
-
- .font-bold {
- font-weight: 700;
- }
-
- .font-black {
- font-weight: 900;
- }
-
- .h-1 {
- height: .25rem;
- }
-
- .leading-normal {
- line-height: 1.5;
- }
-
- .m-8 {
- margin: 2rem;
- }
-
- .my-3 {
- margin-top: .75rem;
- margin-bottom: .75rem;
- }
-
- .mb-8 {
- margin-bottom: 2rem;
- }
+ <head>
+ <title>@yield('title')</title>
- .max-w-sm {
- max-width: 30rem;
- }
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- .min-h-screen {
- min-height: 100vh;
- }
+ <!-- Fonts -->
+ <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">
- .py-3 {
- padding-top: .75rem;
- padding-bottom: .75rem;
- }
+ <!-- Styles -->
+ <style>
+ html {
+ line-height: 1.15;
+ -ms-text-size-adjust: 100%;
+ -webkit-text-size-adjust: 100%;
+ }
- .px-6 {
- padding-left: 1.5rem;
- padding-right: 1.5rem;
- }
+ body {
+ margin: 0;
+ }
- .pb-full {
- padding-bottom: 100%;
- }
+ header,
+ nav,
+ section {
+ display: block;
+ }
- .absolute {
- position: absolute;
- }
+ figcaption,
+ main {
+ display: block;
+ }
- .relative {
- position: relative;
- }
+ a {
+ background-color: transparent;
+ -webkit-text-decoration-skip: objects;
+ }
- .pin {
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- }
+ strong {
+ font-weight: inherit;
+ }
- .text-black {
- color: #22292f;
- }
+ strong {
+ font-weight: bolder;
+ }
- .text-grey-darkest {
- color: #3d4852;
- }
+ code {
+ font-family: monospace, monospace;
+ font-size: 1em;
+ }
- .text-grey-darker {
- color: #606f7b;
- }
+ dfn {
+ font-style: italic;
+ }
- .text-2xl {
- font-size: 1.5rem;
- }
+ svg:not(:root) {
+ overflow: hidden;
+ }
- .text-5xl {
- font-size: 3rem;
- }
+ button,
+ input {
+ font-family: sans-serif;
+ font-size: 100%;
+ line-height: 1.15;
+ margin: 0;
+ }
- .uppercase {
- text-transform: uppercase;
- }
+ button,
+ input {
+ overflow: visible;
+ }
- .antialiased {
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
+ button {
+ text-transform: none;
+ }
- .tracking-wide {
- letter-spacing: .05em;
- }
+ button,
+ html [type="button"],
+ [type="reset"],
+ [type="submit"] {
+ -webkit-appearance: button;
+ }
- .w-16 {
- width: 4rem;
- }
+ button::-moz-focus-inner,
+ [type="button"]::-moz-focus-inner,
+ [type="reset"]::-moz-focus-inner,
+ [type="submit"]::-moz-focus-inner {
+ border-style: none;
+ padding: 0;
+ }
- .w-full {
- width: 100%;
- }
+ button:-moz-focusring,
+ [type="button"]:-moz-focusring,
+ [type="reset"]:-moz-focusring,
+ [type="submit"]:-moz-focusring {
+ outline: 1px dotted ButtonText;
+ }
- @media (min-width: 768px) {
- .md\:bg-left {
- background-position: left;
+ legend {
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ color: inherit;
+ display: table;
+ max-width: 100%;
+ padding: 0;
+ white-space: normal;
}
- .md\:bg-right {
- background-position: right;
+ [type="checkbox"],
+ [type="radio"] {
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 0;
}
- .md\:flex {
- display: -webkit-box;
- display: -ms-flexbox;
- display: flex;
+ [type="number"]::-webkit-inner-spin-button,
+ [type="number"]::-webkit-outer-spin-button {
+ height: auto;
}
- .md\:my-6 {
- margin-top: 1.5rem;
- margin-bottom: 1.5rem;
+ [type="search"] {
+ -webkit-appearance: textfield;
+ outline-offset: -2px;
}
- .md\:min-h-screen {
- min-height: 100vh;
+ [type="search"]::-webkit-search-cancel-button,
+ [type="search"]::-webkit-search-decoration {
+ -webkit-appearance: none;
}
- .md\:pb-0 {
- padding-bottom: 0;
+ ::-webkit-file-upload-button {
+ -webkit-appearance: button;
+ font: inherit;
}
- .md\:text-3xl {
- font-size: 1.875rem;
+ menu {
+ display: block;
}
- .md\:text-15xl {
- font-size: 9rem;
+ canvas {
+ display: inline-block;
}
- .md\:w-1\/2 {
- width: 50%;
+ template {
+ display: none;
}
- }
- @media (min-width: 992px) {
- .lg\:bg-center {
- background-position: center;
+ [hidden] {
+ display: none;
}
- }
- </style>
- </head>
- <body class="antialiased font-sans">
- <div class="md:flex min-h-screen">
- <div class="w-full md:w-1/2 bg-white flex items-center justify-center">
- <div class="max-w-sm m-8">
- <div class="text-black text-5xl md:text-15xl font-black">
- @yield('code', __('Oh no'))
- </div>
- <div class="w-16 h-1 bg-purple-light my-3 md:my-6"></div>
+ html {
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ font-family: sans-serif;
+ }
- <p class="text-grey-darker text-2xl md:text-3xl font-light mb-8 leading-normal">
- @yield('message')
- </p>
+ *,
+ *::before,
+ *::after {
+ -webkit-box-sizing: inherit;
+ box-sizing: inherit;
+ }
- <a href="/">
- <button class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
- {{ __('Go Home') }}
- </button>
- </a>
- </div>
- </div>
+ p {
+ margin: 0;
+ }
+
+ button {
+ background: transparent;
+ padding: 0;
+ }
+
+ button:focus {
+ outline: 1px dotted;
+ outline: 5px auto -webkit-focus-ring-color;
+ }
+
+ *,
+ *::before,
+ *::after {
+ border-width: 0;
+ border-style: solid;
+ border-color: #dae1e7;
+ }
+
+ button,
+ [type="button"],
+ [type="reset"],
+ [type="submit"] {
+ border-radius: 0;
+ }
+
+ button,
+ input {
+ font-family: inherit;
+ }
+
+ input::-webkit-input-placeholder {
+ color: inherit;
+ opacity: .5;
+ }
+
+ input:-ms-input-placeholder {
+ color: inherit;
+ opacity: .5;
+ }
+
+ input::-ms-input-placeholder {
+ color: inherit;
+ opacity: .5;
+ }
+
+ input::placeholder {
+ color: inherit;
+ opacity: .5;
+ }
+
+ button,
+ [role=button] {
+ cursor: pointer;
+ }
+
+ .bg-transparent {
+ background-color: transparent;
+ }
+
+ .bg-white {
+ background-color: #fff;
+ }
+
+ .bg-teal-light {
+ background-color: #64d5ca;
+ }
+
+ .bg-blue-dark {
+ background-color: #2779bd;
+ }
+
+ .bg-indigo-light {
+ background-color: #7886d7;
+ }
+
+ .bg-purple-light {
+ background-color: #a779e9;
+ }
+
+ .bg-no-repeat {
+ background-repeat: no-repeat;
+ }
+
+ .bg-cover {
+ background-size: cover;
+ }
+
+ .border-grey-light {
+ border-color: #dae1e7;
+ }
+
+ .hover\:border-grey:hover {
+ border-color: #b8c2cc;
+ }
+
+ .rounded-lg {
+ border-radius: .5rem;
+ }
+
+ .border-2 {
+ border-width: 2px;
+ }
+
+ .hidden {
+ display: none;
+ }
+
+ .flex {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ }
+
+ .items-center {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ }
+
+ .justify-center {
+ -webkit-box-pack: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ }
+
+ .font-sans {
+ font-family: Nunito, sans-serif;
+ }
+
+ .font-light {
+ font-weight: 300;
+ }
+
+ .font-bold {
+ font-weight: 700;
+ }
+
+ .font-black {
+ font-weight: 900;
+ }
+
+ .h-1 {
+ height: .25rem;
+ }
+
+ .leading-normal {
+ line-height: 1.5;
+ }
+
+ .m-8 {
+ margin: 2rem;
+ }
+
+ .my-3 {
+ margin-top: .75rem;
+ margin-bottom: .75rem;
+ }
+
+ .mb-8 {
+ margin-bottom: 2rem;
+ }
+
+ .max-w-sm {
+ max-width: 30rem;
+ }
+
+ .min-h-screen {
+ min-height: 100vh;
+ }
+
+ .py-3 {
+ padding-top: .75rem;
+ padding-bottom: .75rem;
+ }
+
+ .px-6 {
+ padding-left: 1.5rem;
+ padding-right: 1.5rem;
+ }
- <div class="relative pb-full md:flex md:pb-0 md:min-h-screen w-full md:w-1/2">
- @yield('image')
- </div>
- </div>
- </body>
+ .pb-full {
+ padding-bottom: 100%;
+ }
+
+ .absolute {
+ position: absolute;
+ }
+
+ .relative {
+ position: relative;
+ }
+
+ .pin {
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ }
+
+ .text-black {
+ color: #22292f;
+ }
+
+ .text-grey-darkest {
+ color: #3d4852;
+ }
+
+ .text-grey-darker {
+ color: #606f7b;
+ }
+
+ .text-2xl {
+ font-size: 1.5rem;
+ }
+
+ .text-5xl {
+ font-size: 3rem;
+ }
+
+ .uppercase {
+ text-transform: uppercase;
+ }
+
+ .antialiased {
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
+
+ .tracking-wide {
+ letter-spacing: .05em;
+ }
+
+ .w-16 {
+ width: 4rem;
+ }
+
+ .w-full {
+ width: 100%;
+ }
+
+ @media (min-width: 768px) {
+ .md\:bg-left {
+ background-position: left;
+ }
+
+ .md\:bg-right {
+ background-position: right;
+ }
+
+ .md\:flex {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ }
+
+ .md\:my-6 {
+ margin-top: 1.5rem;
+ margin-bottom: 1.5rem;
+ }
+
+ .md\:min-h-screen {
+ min-height: 100vh;
+ }
+
+ .md\:pb-0 {
+ padding-bottom: 0;
+ }
+
+ .md\:text-3xl {
+ font-size: 1.875rem;
+ }
+
+ .md\:text-15xl {
+ font-size: 9rem;
+ }
+
+ .md\:w-1\/2 {
+ width: 50%;
+ }
+ }
+
+ @media (min-width: 992px) {
+ .lg\:bg-center {
+ background-position: center;
+ }
+ }
+ </style>
+ </head>
+ <body class="antialiased font-sans">
+ <div class="md:flex min-h-screen">
+ <div class="w-full md:w-1/2 bg-white flex items-center justify-center">
+ <div class="max-w-sm m-8">
+ <div class="text-black text-5xl md:text-15xl font-black">
+ @yield('code', __('Oh no'))
+ </div>
+
+ <div class="w-16 h-1 bg-purple-light my-3 md:my-6"></div>
+
+ <p class="text-grey-darker text-2xl md:text-3xl font-light mb-8 leading-normal">
+ @yield('message')
+ </p>
+
+ <a href="/">
+ <button class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
+ {{ __('Go Home') }}
+ </button>
+ </a>
+ </div>
+ </div>
+
+ <div class="relative pb-full md:flex md:pb-0 md:min-h-screen w-full md:w-1/2">
+ @yield('image')
+ </div>
+ </div>
+ </body>
</html> | false |
Other | laravel | framework | 83bd575a3f14a9b48114b9f06b723dcdbe0aa061.json | Fix the return types for Command methods (#25425) | src/Illuminate/Console/Command.php | @@ -315,7 +315,7 @@ public function confirm($question, $default = false)
*
* @param string $question
* @param string|null $default
- * @return string
+ * @return mixed
*/
public function ask($question, $default = null)
{
@@ -328,7 +328,7 @@ public function ask($question, $default = null)
* @param string $question
* @param array $choices
* @param string|null $default
- * @return string
+ * @return mixed
*/
public function anticipate($question, array $choices, $default = null)
{
@@ -341,7 +341,7 @@ public function anticipate($question, array $choices, $default = null)
* @param string $question
* @param array $choices
* @param string|null $default
- * @return string
+ * @return mixed
*/
public function askWithCompletion($question, array $choices, $default = null)
{
@@ -357,7 +357,7 @@ public function askWithCompletion($question, array $choices, $default = null)
*
* @param string $question
* @param bool $fallback
- * @return string
+ * @return mixed
*/
public function secret($question, $fallback = true)
{ | false |
Other | laravel | framework | 9d8452da5511c72592d14a1d59abda34506d104b.json | Translate error messsages (#25395) | src/Illuminate/Foundation/Exceptions/views/403.blade.php | @@ -1,11 +1,11 @@
@extends('errors::illustrated-layout')
@section('code', '403')
-@section('title', 'Unauthorized')
+@section('title', __('Unauthorized'))
@section('image')
<div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
-@section('message', 'Sorry, you are not authorized to access this page.')
+@section('message', __('Sorry, you are not authorized to access this page.')) | true |
Other | laravel | framework | 9d8452da5511c72592d14a1d59abda34506d104b.json | Translate error messsages (#25395) | src/Illuminate/Foundation/Exceptions/views/404.blade.php | @@ -1,11 +1,11 @@
@extends('errors::illustrated-layout')
@section('code', '404')
-@section('title', 'Page Not Found')
+@section('title', __('Page Not Found'))
@section('image')
<div style="background-image: url('/svg/404.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
-@section('message', 'Sorry, the page you are looking for could not be found.')
+@section('message', __('Sorry, the page you are looking for could not be found.')) | true |
Other | laravel | framework | 9d8452da5511c72592d14a1d59abda34506d104b.json | Translate error messsages (#25395) | src/Illuminate/Foundation/Exceptions/views/419.blade.php | @@ -1,11 +1,11 @@
@extends('errors::illustrated-layout')
@section('code', '419')
-@section('title', 'Page Expired')
+@section('title', __('Page Expired'))
@section('image')
<div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
-@section('message', 'Sorry, your session has expired. Please refresh and try again.')
+@section('message', __('Sorry, your session has expired. Please refresh and try again.')) | true |
Other | laravel | framework | 9d8452da5511c72592d14a1d59abda34506d104b.json | Translate error messsages (#25395) | src/Illuminate/Foundation/Exceptions/views/429.blade.php | @@ -1,11 +1,11 @@
@extends('errors::illustrated-layout')
@section('code', '429')
-@section('title', 'Too Many Requests')
+@section('title', __('Too Many Requests'))
@section('image')
<div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
-@section('message', 'Sorry, you are making too many requests to our servers.')
+@section('message', __('Sorry, you are making too many requests to our servers.')) | true |
Other | laravel | framework | 9d8452da5511c72592d14a1d59abda34506d104b.json | Translate error messsages (#25395) | src/Illuminate/Foundation/Exceptions/views/500.blade.php | @@ -1,11 +1,11 @@
@extends('errors::illustrated-layout')
@section('code', '500')
-@section('title', 'Error')
+@section('title', __('Error'))
@section('image')
<div style="background-image: url('/svg/500.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
-@section('message', 'Whoops, something went wrong on our servers.')
+@section('message', __('Whoops, something went wrong on our servers.')) | true |
Other | laravel | framework | 9d8452da5511c72592d14a1d59abda34506d104b.json | Translate error messsages (#25395) | src/Illuminate/Foundation/Exceptions/views/503.blade.php | @@ -1,11 +1,11 @@
@extends('errors::illustrated-layout')
@section('code', '503')
-@section('title', 'Service Unavailable')
+@section('title', __('Service Unavailable'))
@section('image')
<div style="background-image: url('/svg/503.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
-@section('message', 'Sorry, we are doing some maintenance. Please check back soon.')
+@section('message', __('Sorry, we are doing some maintenance. Please check back soon.')) | true |
Other | laravel | framework | 9d8452da5511c72592d14a1d59abda34506d104b.json | Translate error messsages (#25395) | src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php | @@ -460,7 +460,7 @@
<div class="w-full md:w-1/2 bg-white flex items-center justify-center">
<div class="max-w-sm m-8">
<div class="text-black text-5xl md:text-15xl font-black">
- @yield('code', 'Oh no')
+ @yield('code', __('Oh no'))
</div>
<div class="w-16 h-1 bg-purple-light my-3 md:my-6"></div>
@@ -471,7 +471,7 @@
<a href="/">
<button class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
- Go Home
+ {{ __('Go Home') }}
</button>
</a>
</div> | true |
Other | laravel | framework | 2265a8c9a110679c041da2f9bbe407e732e49071.json | add new error pages | src/Illuminate/Foundation/Exceptions/views/403.blade.php | @@ -0,0 +1,11 @@
+@extends('errors::layout')
+
+@section('code', '403')
+@section('title', 'Unauthorized')
+
+@section('image')
+<div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
+</div>
+@endsection
+
+@section('message', 'Sorry, you may not access this page.') | true |
Other | laravel | framework | 2265a8c9a110679c041da2f9bbe407e732e49071.json | add new error pages | src/Illuminate/Foundation/Exceptions/views/404.blade.php | @@ -1,5 +1,11 @@
@extends('errors::layout')
+@section('code', '404')
@section('title', 'Page Not Found')
+@section('image')
+<div style="background-image: url('/svg/404.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
+</div>
+@endsection
+
@section('message', 'Sorry, the page you are looking for could not be found.') | true |
Other | laravel | framework | 2265a8c9a110679c041da2f9bbe407e732e49071.json | add new error pages | src/Illuminate/Foundation/Exceptions/views/419.blade.php | @@ -1,9 +1,11 @@
@extends('errors::layout')
+@section('code', '419')
@section('title', 'Page Expired')
-@section('message')
- The page has expired due to inactivity.
- <br/><br/>
- Please refresh and try again.
-@stop
+@section('image')
+<div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
+</div>
+@endsection
+
+@section('message', 'Sorry, your session has expired. Please refresh and try again.') | true |
Other | laravel | framework | 2265a8c9a110679c041da2f9bbe407e732e49071.json | add new error pages | src/Illuminate/Foundation/Exceptions/views/429.blade.php | @@ -1,5 +1,11 @@
@extends('errors::layout')
-@section('title', 'Error')
+@section('code', '429')
+@section('title', 'Too Many Requests')
-@section('message', 'Too many requests.')
+@section('image')
+<div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
+</div>
+@endsection
+
+@section('message', 'Sorry, you are making too many requests to our servers.') | true |
Other | laravel | framework | 2265a8c9a110679c041da2f9bbe407e732e49071.json | add new error pages | src/Illuminate/Foundation/Exceptions/views/500.blade.php | @@ -1,5 +1,11 @@
@extends('errors::layout')
+@section('code', '500')
@section('title', 'Error')
-@section('message', 'Whoops, looks like something went wrong.')
+@section('image')
+<div style="background-image: url('/svg/500.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
+</div>
+@endsection
+
+@section('message', 'Whoops, something went wrong on our servers.') | true |
Other | laravel | framework | 2265a8c9a110679c041da2f9bbe407e732e49071.json | add new error pages | src/Illuminate/Foundation/Exceptions/views/503.blade.php | @@ -1,5 +1,11 @@
@extends('errors::layout')
+@section('code', '503')
@section('title', 'Service Unavailable')
-@section('message', 'Be right back.')
+@section('image')
+<div style="background-image: url('/svg/503.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
+</div>
+@endsection
+
+@section('message', 'Sorry, we are doing some maintenance. Please check back soon.') | true |
Other | laravel | framework | 2265a8c9a110679c041da2f9bbe407e732e49071.json | add new error pages | src/Illuminate/Foundation/Exceptions/views/layout.blade.php | @@ -1,57 +1,483 @@
-<!DOCTYPE html>
+<!doctype html>
<html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
-
- <title>@yield('title')</title>
-
- <!-- Fonts -->
- <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">
-
- <!-- Styles -->
- <style>
- html, body {
- background-color: #fff;
- color: #636b6f;
- font-family: 'Nunito', sans-serif;
- font-weight: 100;
- height: 100vh;
- margin: 0;
- }
-
- .full-height {
- height: 100vh;
- }
-
- .flex-center {
+ <head>
+ <title>@yield('title')</title>
+
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
+ <!-- Fonts -->
+ <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">
+
+ <!-- Styles -->
+ <style>
+ html {
+ line-height: 1.15;
+ -ms-text-size-adjust: 100%;
+ -webkit-text-size-adjust: 100%;
+ }
+
+ body {
+ margin: 0;
+ }
+
+ header,
+ nav,
+ section {
+ display: block;
+ }
+
+ figcaption,
+ main {
+ display: block;
+ }
+
+ a {
+ background-color: transparent;
+ -webkit-text-decoration-skip: objects;
+ }
+
+ strong {
+ font-weight: inherit;
+ }
+
+ strong {
+ font-weight: bolder;
+ }
+
+ code {
+ font-family: monospace, monospace;
+ font-size: 1em;
+ }
+
+ dfn {
+ font-style: italic;
+ }
+
+ svg:not(:root) {
+ overflow: hidden;
+ }
+
+ button,
+ input {
+ font-family: sans-serif;
+ font-size: 100%;
+ line-height: 1.15;
+ margin: 0;
+ }
+
+ button,
+ input {
+ overflow: visible;
+ }
+
+ button {
+ text-transform: none;
+ }
+
+ button,
+ html [type="button"],
+ [type="reset"],
+ [type="submit"] {
+ -webkit-appearance: button;
+ }
+
+ button::-moz-focus-inner,
+ [type="button"]::-moz-focus-inner,
+ [type="reset"]::-moz-focus-inner,
+ [type="submit"]::-moz-focus-inner {
+ border-style: none;
+ padding: 0;
+ }
+
+ button:-moz-focusring,
+ [type="button"]:-moz-focusring,
+ [type="reset"]:-moz-focusring,
+ [type="submit"]:-moz-focusring {
+ outline: 1px dotted ButtonText;
+ }
+
+ legend {
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ color: inherit;
+ display: table;
+ max-width: 100%;
+ padding: 0;
+ white-space: normal;
+ }
+
+ [type="checkbox"],
+ [type="radio"] {
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 0;
+ }
+
+ [type="number"]::-webkit-inner-spin-button,
+ [type="number"]::-webkit-outer-spin-button {
+ height: auto;
+ }
+
+ [type="search"] {
+ -webkit-appearance: textfield;
+ outline-offset: -2px;
+ }
+
+ [type="search"]::-webkit-search-cancel-button,
+ [type="search"]::-webkit-search-decoration {
+ -webkit-appearance: none;
+ }
+
+ ::-webkit-file-upload-button {
+ -webkit-appearance: button;
+ font: inherit;
+ }
+
+ menu {
+ display: block;
+ }
+
+ canvas {
+ display: inline-block;
+ }
+
+ template {
+ display: none;
+ }
+
+ [hidden] {
+ display: none;
+ }
+
+ html {
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ font-family: sans-serif;
+ }
+
+ *,
+ *::before,
+ *::after {
+ -webkit-box-sizing: inherit;
+ box-sizing: inherit;
+ }
+
+ p {
+ margin: 0;
+ }
+
+ button {
+ background: transparent;
+ padding: 0;
+ }
+
+ button:focus {
+ outline: 1px dotted;
+ outline: 5px auto -webkit-focus-ring-color;
+ }
+
+ *,
+ *::before,
+ *::after {
+ border-width: 0;
+ border-style: solid;
+ border-color: #dae1e7;
+ }
+
+ button,
+ [type="button"],
+ [type="reset"],
+ [type="submit"] {
+ border-radius: 0;
+ }
+
+ button,
+ input {
+ font-family: inherit;
+ }
+
+ input::-webkit-input-placeholder {
+ color: inherit;
+ opacity: .5;
+ }
+
+ input:-ms-input-placeholder {
+ color: inherit;
+ opacity: .5;
+ }
+
+ input::-ms-input-placeholder {
+ color: inherit;
+ opacity: .5;
+ }
+
+ input::placeholder {
+ color: inherit;
+ opacity: .5;
+ }
+
+ button,
+ [role=button] {
+ cursor: pointer;
+ }
+
+ .bg-transparent {
+ background-color: transparent;
+ }
+
+ .bg-white {
+ background-color: #fff;
+ }
+
+ .bg-teal-light {
+ background-color: #64d5ca;
+ }
+
+ .bg-blue-dark {
+ background-color: #2779bd;
+ }
+
+ .bg-indigo-light {
+ background-color: #7886d7;
+ }
+
+ .bg-purple-light {
+ background-color: #a779e9;
+ }
+
+ .bg-no-repeat {
+ background-repeat: no-repeat;
+ }
+
+ .bg-cover {
+ background-size: cover;
+ }
+
+ .border-grey-light {
+ border-color: #dae1e7;
+ }
+
+ .hover\:border-grey:hover {
+ border-color: #b8c2cc;
+ }
+
+ .rounded-lg {
+ border-radius: .5rem;
+ }
+
+ .border-2 {
+ border-width: 2px;
+ }
+
+ .hidden {
+ display: none;
+ }
+
+ .flex {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ }
+
+ .items-center {
+ -webkit-box-align: center;
+ -ms-flex-align: center;
align-items: center;
- display: flex;
+ }
+
+ .justify-center {
+ -webkit-box-pack: center;
+ -ms-flex-pack: center;
justify-content: center;
- }
-
- .position-ref {
- position: relative;
- }
-
- .content {
- text-align: center;
- }
-
- .title {
- font-size: 36px;
- padding: 20px;
- }
- </style>
- </head>
- <body>
- <div class="flex-center position-ref full-height">
- <div class="content">
- <div class="title">
- @yield('message')
- </div>
- </div>
+ }
+
+ .font-sans {
+ font-family: Nunito, sans-serif;
+ }
+
+ .font-light {
+ font-weight: 300;
+ }
+
+ .font-bold {
+ font-weight: 700;
+ }
+
+ .font-black {
+ font-weight: 900;
+ }
+
+ .h-1 {
+ height: .25rem;
+ }
+
+ .leading-normal {
+ line-height: 1.5;
+ }
+
+ .m-8 {
+ margin: 2rem;
+ }
+
+ .my-3 {
+ margin-top: .75rem;
+ margin-bottom: .75rem;
+ }
+
+ .mb-8 {
+ margin-bottom: 2rem;
+ }
+
+ .max-w-sm {
+ max-width: 30rem;
+ }
+
+ .min-h-screen {
+ min-height: 100vh;
+ }
+
+ .py-3 {
+ padding-top: .75rem;
+ padding-bottom: .75rem;
+ }
+
+ .px-6 {
+ padding-left: 1.5rem;
+ padding-right: 1.5rem;
+ }
+
+ .pb-full {
+ padding-bottom: 100%;
+ }
+
+ .absolute {
+ position: absolute;
+ }
+
+ .relative {
+ position: relative;
+ }
+
+ .pin {
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ }
+
+ .text-black {
+ color: #22292f;
+ }
+
+ .text-grey-darkest {
+ color: #3d4852;
+ }
+
+ .text-grey-darker {
+ color: #606f7b;
+ }
+
+ .text-2xl {
+ font-size: 1.5rem;
+ }
+
+ .text-5xl {
+ font-size: 3rem;
+ }
+
+ .uppercase {
+ text-transform: uppercase;
+ }
+
+ .antialiased {
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
+
+ .tracking-wide {
+ letter-spacing: .05em;
+ }
+
+ .w-16 {
+ width: 4rem;
+ }
+
+ .w-full {
+ width: 100%;
+ }
+
+ @media (min-width: 768px) {
+ .md\:bg-left {
+ background-position: left;
+ }
+
+ .md\:bg-right {
+ background-position: right;
+ }
+
+ .md\:flex {
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: flex;
+ }
+
+ .md\:my-6 {
+ margin-top: 1.5rem;
+ margin-bottom: 1.5rem;
+ }
+
+ .md\:min-h-screen {
+ min-height: 100vh;
+ }
+
+ .md\:pb-0 {
+ padding-bottom: 0;
+ }
+
+ .md\:text-3xl {
+ font-size: 1.875rem;
+ }
+
+ .md\:text-15xl {
+ font-size: 9rem;
+ }
+
+ .md\:w-1\/2 {
+ width: 50%;
+ }
+ }
+
+ @media (min-width: 992px) {
+ .lg\:bg-center {
+ background-position: center;
+ }
+ }
+ </style>
+ </head>
+ <body class="antialiased font-sans">
+ <div class="md:flex min-h-screen">
+ <div class="w-full md:w-1/2 bg-white flex items-center justify-center">
+ <div class="max-w-sm m-8">
+ <div class="text-black text-5xl md:text-15xl font-black">
+ @yield('code', 'Oh no')
+ </div>
+
+ <div class="w-16 h-1 bg-purple-light my-3 md:my-6"></div>
+
+ <p class="text-grey-darker text-2xl md:text-3xl font-light mb-8 leading-normal">
+ @yield('message')
+ </p>
+
+ <button class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
+ Go Home
+ </button>
</div>
- </body>
+ </div>
+
+ <div class="relative pb-full md:flex md:pb-0 md:min-h-screen w-full md:w-1/2">
+ @yield('image')
+ </div>
+ </div>
+ </body>
</html> | true |
Other | laravel | framework | 2265a8c9a110679c041da2f9bbe407e732e49071.json | add new error pages | src/Illuminate/Foundation/Exceptions/views/legacy-layout.blade.php | @@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ <title>@yield('title')</title>
+
+ <!-- Fonts -->
+ <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">
+
+ <!-- Styles -->
+ <style>
+ html, body {
+ background-color: #fff;
+ color: #636b6f;
+ font-family: 'Nunito', sans-serif;
+ font-weight: 100;
+ height: 100vh;
+ margin: 0;
+ }
+
+ .full-height {
+ height: 100vh;
+ }
+
+ .flex-center {
+ align-items: center;
+ display: flex;
+ justify-content: center;
+ }
+
+ .position-ref {
+ position: relative;
+ }
+
+ .content {
+ text-align: center;
+ }
+
+ .title {
+ font-size: 36px;
+ padding: 20px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="flex-center position-ref full-height">
+ <div class="content">
+ <div class="title">
+ @yield('message')
+ </div>
+ </div>
+ </div>
+ </body>
+</html> | true |
Other | laravel | framework | c88acdf0880a551f3ee2a99900efbb458afef135.json | Fix Builder PHPDoc (#25367) | src/Illuminate/Database/Query/Builder.php | @@ -1061,7 +1061,7 @@ public function orWhereNotNull($column)
*
* @param string $column
* @param string $operator
- * @param \DateTimeInterface|string|int $value
+ * @param \DateTimeInterface|string $value
* @param string $boolean
* @return \Illuminate\Database\Query\Builder|static
*/
@@ -1083,7 +1083,7 @@ public function whereDate($column, $operator, $value = null, $boolean = 'and')
*
* @param string $column
* @param string $operator
- * @param \DateTimeInterface|string|int $value
+ * @param \DateTimeInterface|string $value
* @return \Illuminate\Database\Query\Builder|static
*/
public function orWhereDate($column, $operator, $value = null)
@@ -1100,7 +1100,7 @@ public function orWhereDate($column, $operator, $value = null)
*
* @param string $column
* @param string $operator
- * @param \DateTimeInterface|string|int $value
+ * @param \DateTimeInterface|string $value
* @param string $boolean
* @return \Illuminate\Database\Query\Builder|static
*/
@@ -1122,7 +1122,7 @@ public function whereTime($column, $operator, $value = null, $boolean = 'and')
*
* @param string $column
* @param string $operator
- * @param \DateTimeInterface|string|int $value
+ * @param \DateTimeInterface|string $value
* @return \Illuminate\Database\Query\Builder|static
*/
public function orWhereTime($column, $operator, $value = null)
@@ -1139,7 +1139,7 @@ public function orWhereTime($column, $operator, $value = null)
*
* @param string $column
* @param string $operator
- * @param \DateTimeInterface|string|int $value
+ * @param \DateTimeInterface|string $value
* @param string $boolean
* @return \Illuminate\Database\Query\Builder|static
*/
@@ -1161,7 +1161,7 @@ public function whereDay($column, $operator, $value = null, $boolean = 'and')
*
* @param string $column
* @param string $operator
- * @param \DateTimeInterface|string|int $value
+ * @param \DateTimeInterface|string $value
* @return \Illuminate\Database\Query\Builder|static
*/
public function orWhereDay($column, $operator, $value = null)
@@ -1178,7 +1178,7 @@ public function orWhereDay($column, $operator, $value = null)
*
* @param string $column
* @param string $operator
- * @param \DateTimeInterface|string|int $value
+ * @param \DateTimeInterface|string $value
* @param string $boolean
* @return \Illuminate\Database\Query\Builder|static
*/
@@ -1200,7 +1200,7 @@ public function whereMonth($column, $operator, $value = null, $boolean = 'and')
*
* @param string $column
* @param string $operator
- * @param \DateTimeInterface|string|int $value
+ * @param \DateTimeInterface|string $value
* @return \Illuminate\Database\Query\Builder|static
*/
public function orWhereMonth($column, $operator, $value = null) | false |
Other | laravel | framework | 1d566d0dece7f0d2e640bc257845b19ad398ed53.json | Fix param docblock. (#25364) | src/Illuminate/Support/Optional.php | @@ -45,7 +45,7 @@ public function __get($key)
/**
* Dynamically check a property exists on the underlying object.
*
- * @param $name
+ * @param mixed $name
* @return bool
*/
public function __isset($name) | false |
Other | laravel | framework | b3079f35c0470e4615a2aa3abd9a50fff412c3c5.json | Simplify facade to use swap method only | src/Illuminate/Support/Facades/Date.php | @@ -2,9 +2,7 @@
namespace Illuminate\Support\Facades;
-use DateTimeInterface;
use ReflectionException;
-use InvalidArgumentException;
use Illuminate\Support\Carbon;
/**
@@ -85,20 +83,6 @@
*/
class Date extends Facade
{
- /**
- * Date instance class name.
- *
- * @var string
- */
- protected static $className = Carbon::class;
-
- /**
- * Date interceptor.
- *
- * @var callable
- */
- protected static $interceptor;
-
/**
* Get the registered name of the component.
*
@@ -111,32 +95,6 @@ protected static function getFacadeAccessor()
return 'date';
}
- /**
- * Change the class to use for date instances.
- *
- * @param string $className
- */
- public static function use(string $className)
- {
- if (! (class_exists($className) && (in_array(DateTimeInterface::class, class_implements($className)) || method_exists($className, 'instance')))) {
- throw new InvalidArgumentException(
- 'Date class must implement a public static instance(DateTimeInterface $date) method or implements DateTimeInterface.'
- );
- }
-
- static::$className = $className;
- }
-
- /**
- * Set an interceptor for each date (Carbon instance).
- *
- * @param callable $interceptor
- */
- public static function intercept(callable $interceptor)
- {
- static::$interceptor = $interceptor;
- }
-
/**
* Handle dynamic, static calls to the object.
*
@@ -149,30 +107,35 @@ public static function intercept(callable $interceptor)
*/
public static function __callStatic($method, $args)
{
+ $root = null;
+
try {
- if (static::getFacadeRoot()) {
- return parent::__callStatic($method, $args);
- }
+ $root = static::getFacadeRoot();
} catch (ReflectionException $exception) {
// continue
}
- if (method_exists(static::$className, $method)) {
- $date = static::$className::$method(...$args);
- } else {
+ if (! $root) {
+ Date::swap($root = Carbon::class);
+ }
+
+ if (is_callable($root)) {
+ return $root(Carbon::$method(...$args));
+ }
+
+ if (is_string($root)) {
+ if (method_exists($root, $method)) {
+ return $root::$method(...$args);
+ }
/** @var Carbon $date */
$date = Carbon::$method(...$args);
- if (method_exists(static::$className, 'instance')) {
- $date = static::$className::instance($date);
- } else {
- $date = new static::$className($date->format('Y-m-d H:i:s.u'), $date->getTimezone());
+ if (method_exists($root, 'instance')) {
+ return $root::instance($date);
}
- }
- if (static::$interceptor) {
- return call_user_func(static::$interceptor, $date);
+ return new $root($date->format('Y-m-d H:i:s.u'), $date->getTimezone());
}
- return $date;
+ return parent::__callStatic($method, $args);
}
} | true |
Other | laravel | framework | b3079f35c0470e4615a2aa3abd9a50fff412c3c5.json | Simplify facade to use swap method only | tests/Support/DateFacadeTest.php | @@ -14,8 +14,8 @@ class DateFacadeTest extends TestCase
protected function tearDown()
{
parent::tearDown();
- Date::use(Carbon::class);
- Date::intercept(function ($date) {
+ Date::swap(Carbon::class);
+ Date::swap(function ($date) {
return $date;
});
}
@@ -31,63 +31,45 @@ protected static function assertBetweenStartAndNow($start, $actual)
);
}
- public function testIntercept()
+ public function testSwapClosure()
{
$start = Carbon::now()->getTimestamp();
$this->assertSame(Carbon::class, get_class(Date::now()));
$this->assertBetweenStartAndNow($start, Date::now()->getTimestamp());
- Date::intercept(function (Carbon $date) {
+ Date::swap(function (Carbon $date) {
return new DateTime($date->format('Y-m-d H:i:s.u'), $date->getTimezone());
});
$start = Carbon::now()->getTimestamp();
$this->assertSame(DateTime::class, get_class(Date::now()));
$this->assertBetweenStartAndNow($start, Date::now()->getTimestamp());
}
- public function testUse()
+ public function testSwapClassName()
{
$start = Carbon::now()->getTimestamp();
$this->assertSame(Carbon::class, get_class(Date::now()));
$this->assertBetweenStartAndNow($start, Date::now()->getTimestamp());
- Date::use(DateTime::class);
+ Date::swap(DateTime::class);
$start = Carbon::now()->getTimestamp();
$this->assertSame(DateTime::class, get_class(Date::now()));
$this->assertBetweenStartAndNow($start, Date::now()->getTimestamp());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Date class must implement a public static instance(DateTimeInterface $date) method or implements DateTimeInterface.
- */
- public function testUseWrongClass()
- {
- Date::use(Date::class);
- }
-
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Date class must implement a public static instance(DateTimeInterface $date) method or implements DateTimeInterface.
- */
- public function testUseWrongString()
- {
- Date::use('not-a-class');
- }
-
public function testCarbonImmutable()
{
if (! class_exists(CarbonImmutable::class)) {
$this->markTestSkipped('Test for Carbon 2 only');
}
- Date::use(CarbonImmutable::class);
+ Date::swap(CarbonImmutable::class);
$this->assertSame(CarbonImmutable::class, get_class(Date::now()));
- Date::use(Carbon::class);
+ Date::swap(Carbon::class);
$this->assertSame(Carbon::class, get_class(Date::now()));
- Date::intercept(function (Carbon $date) {
+ Date::swap(function (Carbon $date) {
return $date->toImmutable();
});
$this->assertSame(CarbonImmutable::class, get_class(Date::now()));
- Date::intercept(function ($date) {
+ Date::swap(function ($date) {
return $date;
});
$this->assertSame(Carbon::class, get_class(Date::now()));
@@ -99,9 +81,9 @@ public function testCarbonImmutable()
Date::swap(null);
$this->assertSame('en', Date::now()->locale);
include_once __DIR__.'/fixtures/CustomDateClass.php';
- Date::use(\CustomDateClass::class);
+ Date::swap(\CustomDateClass::class);
$this->assertInstanceOf(\CustomDateClass::class, Date::now());
$this->assertInstanceOf(Carbon::class, Date::now()->getOriginal());
- Date::use(Carbon::class);
+ Date::swap(Carbon::class);
}
} | true |
Other | laravel | framework | c5401623dcb8eb3b7511c821c60d97427579cac5.json | Use the getAttributes method on insert (#25355) | src/Illuminate/Database/Eloquent/Model.php | @@ -746,7 +746,7 @@ protected function performInsert(Builder $query)
// If the model has an incrementing key, we can use the "insertGetId" method on
// the query builder, which will give us back the final inserted ID for this
// table from the database. Not all tables have to be incrementing though.
- $attributes = $this->attributes;
+ $attributes = $this->getAttributes();
if ($this->getIncrementing()) {
$this->insertAndSetId($query, $attributes); | false |
Other | laravel | framework | 9e0b94779f5a1ca38a10114a0a897509509d9d31.json | Use higher order messages in Collection (#25356) | src/Illuminate/Database/Eloquent/Collection.php | @@ -361,9 +361,7 @@ public function except($keys)
*/
public function makeHidden($attributes)
{
- return $this->each(function ($model) use ($attributes) {
- $model->addHidden($attributes);
- });
+ return $this->each->addHidden($attributes);
}
/**
@@ -374,9 +372,7 @@ public function makeHidden($attributes)
*/
public function makeVisible($attributes)
{
- return $this->each(function ($model) use ($attributes) {
- $model->makeVisible($attributes);
- });
+ return $this->each->makeVisible($attributes);
}
/** | false |
Other | laravel | framework | 61bdc1f845a1c91ddc1cfadb720052e815b493cc.json | Use the getAttributes method on insert (#25349)
Update the performInsert method to use getAttributes instead of accessing the property directly. | src/Illuminate/Database/Eloquent/Model.php | @@ -681,7 +681,7 @@ protected function performInsert(Builder $query)
// If the model has an incrementing key, we can use the "insertGetId" method on
// the query builder, which will give us back the final inserted ID for this
// table from the database. Not all tables have to be incrementing though.
- $attributes = $this->attributes;
+ $attributes = $this->getAttributes();
if ($this->getIncrementing()) {
$this->insertAndSetId($query, $attributes); | false |
Other | laravel | framework | 8a221bf15334cdc864632f751736cc08d95e1cbb.json | Apply fixes from StyleCI (#25329) | src/Illuminate/Foundation/Testing/PendingCommand.php | @@ -3,10 +3,8 @@
namespace Illuminate\Foundation\Testing;
use Mockery;
-use Illuminate\Support\Str;
use Illuminate\Console\OutputStyle;
use Illuminate\Contracts\Console\Kernel;
-use Mockery\Exception\BadMethodCallException;
use Symfony\Component\Console\Input\ArrayInput;
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
use Symfony\Component\Console\Output\BufferedOutput; | false |
Other | laravel | framework | 947a4f8e518352698e1291dcd6417e36b7b1c70b.json | Fix whereTime() on SQL Server (#25316) | src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php | @@ -103,6 +103,20 @@ protected function whereDate(Builder $query, $where)
return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value;
}
+ /**
+ * Compile a "where time" clause.
+ *
+ * @param \Illuminate\Database\Query\Builder $query
+ * @param array $where
+ * @return string
+ */
+ protected function whereTime(Builder $query, $where)
+ {
+ $value = $this->parameter($where['value']);
+
+ return 'cast('.$this->wrap($where['column']).' as time) '.$where['operator'].' '.$value;
+ }
+
/**
* Compile a "JSON contains" statement into SQL.
* | true |
Other | laravel | framework | 947a4f8e518352698e1291dcd6417e36b7b1c70b.json | Fix whereTime() on SQL Server (#25316) | tests/Database/DatabaseQueryBuilderTest.php | @@ -404,6 +404,19 @@ public function testWhereTimeOperatorOptionalPostgres()
$this->assertEquals([0 => '22:00'], $builder->getBindings());
}
+ public function testWhereTimeSqlServer()
+ {
+ $builder = $this->getSqlServerBuilder();
+ $builder->select('*')->from('users')->whereTime('created_at', '22:00');
+ $this->assertEquals('select * from [users] where cast([created_at] as time) = ?', $builder->toSql());
+ $this->assertEquals([0 => '22:00'], $builder->getBindings());
+
+ $builder = $this->getSqlServerBuilder();
+ $builder->select('*')->from('users')->whereTime('created_at', new Raw('NOW()'));
+ $this->assertEquals('select * from [users] where cast([created_at] as time) = NOW()', $builder->toSql());
+ $this->assertEquals([], $builder->getBindings());
+ }
+
public function testWhereDatePostgres()
{
$builder = $this->getPostgresBuilder(); | true |
Other | laravel | framework | 850b7531d42b6fcd8941b12339fb3135128ba518.json | Use getter method for access primary key (#25303) | src/Illuminate/Database/Eloquent/Model.php | @@ -1345,7 +1345,7 @@ public function resolveRouteBinding($value)
*/
public function getForeignKey()
{
- return Str::snake(class_basename($this)).'_'.$this->primaryKey;
+ return Str::snake(class_basename($this)).'_'.$this->getKeyName();
}
/** | false |
Other | laravel | framework | 8e7942b063d1bb0c8188f298177dcfb4e0141811.json | remove unused var (#25293) | src/Illuminate/Cache/Repository.php | @@ -172,7 +172,7 @@ protected function handleManyResult($keys, $key, $value)
*/
public function pull($key, $default = null)
{
- return tap($this->get($key, $default), function ($value) use ($key) {
+ return tap($this->get($key, $default), function () use ($key) {
$this->forget($key);
});
} | false |
Other | laravel | framework | f5d8c0a673aa9fc6cd94aa4858a0027fe550a22e.json | adjust argument order | src/Illuminate/Auth/Events/Attempting.php | @@ -4,6 +4,13 @@
class Attempting
{
+ /**
+ * The authentication guard implementation.
+ *
+ * @var \Illuminate\Contracts\Auth\StatefulGuard
+ */
+ public $guard;
+
/**
* The credentials for the user.
*
@@ -18,25 +25,18 @@ class Attempting
*/
public $remember;
- /**
- * The guard this attempt is made to.
- *
- * @var \Illuminate\Contracts\Auth\StatefulGuard
- */
- public $guard;
-
/**
* Create a new event instance.
*
+ * @param \Illuminate\Contracts\Auth\StatefulGuard $guard
* @param array $credentials
* @param bool $remember
- * @param \Illuminate\Contracts\Auth\StatefulGuard $guard
* @return void
*/
- public function __construct($credentials, $remember, $guard)
+ public function __construct($guard, $credentials, $remember)
{
+ $this->guard = $guard;
$this->remember = $remember;
$this->credentials = $credentials;
- $this->guard = $guard;
}
} | true |
Other | laravel | framework | f5d8c0a673aa9fc6cd94aa4858a0027fe550a22e.json | adjust argument order | src/Illuminate/Auth/Events/Authenticated.php | @@ -9,27 +9,27 @@ class Authenticated
use SerializesModels;
/**
- * The authenticated user.
+ * The authentication guard implementation.
*
- * @var \Illuminate\Contracts\Auth\Authenticatable
+ * @var \Illuminate\Contracts\Auth\StatefulGuard
*/
- public $user;
+ public $guard;
/**
- * The guard the user is authenticating to.
+ * The authenticated user.
*
- * @var \Illuminate\Contracts\Auth\StatefulGuard
+ * @var \Illuminate\Contracts\Auth\Authenticatable
*/
- public $guard;
+ public $user;
/**
* Create a new event instance.
*
- * @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param \Illuminate\Contracts\Auth\StatefulGuard $guard
+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
* @return void
*/
- public function __construct($user, $guard)
+ public function __construct($guard, $user)
{
$this->user = $user;
$this->guard = $guard; | true |
Other | laravel | framework | f5d8c0a673aa9fc6cd94aa4858a0027fe550a22e.json | adjust argument order | src/Illuminate/Auth/Events/Failed.php | @@ -4,6 +4,13 @@
class Failed
{
+ /**
+ * The authentication guard implementation.
+ *
+ * @var \Illuminate\Contracts\Auth\StatefulGuard
+ */
+ public $guard;
+
/**
* The user the attempter was trying to authenticate as.
*
@@ -18,25 +25,18 @@ class Failed
*/
public $credentials;
- /**
- * The guard the user failed to authenticated to.
- *
- * @var \Illuminate\Contracts\Auth\StatefulGuard
- */
- public $guard;
-
/**
* Create a new event instance.
*
+ * @param \Illuminate\Contracts\Auth\StatefulGuard $guard
* @param \Illuminate\Contracts\Auth\Authenticatable|null $user
* @param array $credentials
- * @param \Illuminate\Contracts\Auth\StatefulGuard $guard
* @return void
*/
- public function __construct($user, $credentials, $guard)
+ public function __construct($guard, $user, $credentials)
{
$this->user = $user;
- $this->credentials = $credentials;
$this->guard = $guard;
+ $this->credentials = $credentials;
}
} | true |
Other | laravel | framework | f5d8c0a673aa9fc6cd94aa4858a0027fe550a22e.json | adjust argument order | src/Illuminate/Auth/Events/Login.php | @@ -8,6 +8,13 @@ class Login
{
use SerializesModels;
+ /**
+ * The authentication guard implementation.
+ *
+ * @var \Illuminate\Contracts\Auth\StatefulGuard
+ */
+ public $guard;
+
/**
* The authenticated user.
*
@@ -22,25 +29,18 @@ class Login
*/
public $remember;
- /**
- * The guard the user authenticated to.
- *
- * @var \Illuminate\Contracts\Auth\StatefulGuard
- */
- public $guard;
-
/**
* Create a new event instance.
*
+ * @param \Illuminate\Contracts\Auth\StatefulGuard $guard
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param bool $remember
- * @param \Illuminate\Contracts\Auth\StatefulGuard $guard
* @return void
*/
- public function __construct($user, $remember, $guard)
+ public function __construct($guard, $user, $remember)
{
$this->user = $user;
- $this->remember = $remember;
$this->guard = $guard;
+ $this->remember = $remember;
}
} | true |
Other | laravel | framework | f5d8c0a673aa9fc6cd94aa4858a0027fe550a22e.json | adjust argument order | src/Illuminate/Auth/Events/Logout.php | @@ -9,27 +9,27 @@ class Logout
use SerializesModels;
/**
- * The authenticated user.
+ * The authenticationg guard implementation.
*
- * @var \Illuminate\Contracts\Auth\Authenticatable
+ * @var \Illuminate\Contracts\Auth\StatefulGuard
*/
- public $user;
+ public $guard;
/**
- * The guard to which the user was authenticated.
+ * The authenticated user.
*
- * @var \Illuminate\Contracts\Auth\StatefulGuard
+ * @var \Illuminate\Contracts\Auth\Authenticatable
*/
- public $guard;
+ public $user;
/**
* Create a new event instance.
*
- * @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param \Illuminate\Contracts\Auth\StatefulGuard $guard
+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
* @return void
*/
- public function __construct($user, $guard)
+ public function __construct($guard, $user)
{
$this->user = $user;
$this->guard = $guard; | true |
Other | laravel | framework | f5d8c0a673aa9fc6cd94aa4858a0027fe550a22e.json | adjust argument order | src/Illuminate/Auth/SessionGuard.php | @@ -493,7 +493,7 @@ public function logout()
}
if (isset($this->events)) {
- $this->events->dispatch(new Events\Logout($user, $this));
+ $this->events->dispatch(new Events\Logout($this, $user));
}
// Once we have fired the logout event we will clear the users out of memory
@@ -576,7 +576,7 @@ protected function fireAttemptEvent(array $credentials, $remember = false)
{
if (isset($this->events)) {
$this->events->dispatch(new Events\Attempting(
- $credentials, $remember, $this
+ $this, $credentials, $remember
));
}
}
@@ -592,7 +592,7 @@ protected function fireLoginEvent($user, $remember = false)
{
if (isset($this->events)) {
$this->events->dispatch(new Events\Login(
- $user, $remember, $this
+ $this, $user, $remember
));
}
}
@@ -607,7 +607,7 @@ protected function fireAuthenticatedEvent($user)
{
if (isset($this->events)) {
$this->events->dispatch(new Events\Authenticated(
- $user, $this
+ $this, $user
));
}
}
@@ -623,7 +623,7 @@ protected function fireFailedEvent($user, array $credentials)
{
if (isset($this->events)) {
$this->events->dispatch(new Events\Failed(
- $user, $credentials, $this
+ $this, $user, $credentials
));
}
}
@@ -645,7 +645,7 @@ public function getLastAttempted()
*/
public function getName()
{
- return 'login_'.$this->getGuardName().'_'.sha1(static::class);
+ return 'login_'.$this->name.'_'.sha1(static::class);
}
/**
@@ -655,17 +655,7 @@ public function getName()
*/
public function getRecallerName()
{
- return 'remember_'.$this->getGuardName().'_'.sha1(static::class);
- }
-
- /**
- * Get the name of the guard, corresponding to name in authentication configuration.
- *
- * @return string
- */
- public function getGuardName()
- {
- return $this->name;
+ return 'remember_'.$this->name.'_'.sha1(static::class);
}
/** | true |
Other | laravel | framework | 69cddedae349956c5f38455e861e3fc490d89a07.json | Add guard to authentication events | src/Illuminate/Auth/Events/Attempting.php | @@ -18,16 +18,25 @@ class Attempting
*/
public $remember;
+ /**
+ * The guard this attempt is made to.
+ *
+ * @var string
+ */
+ public $guard;
+
/**
* Create a new event instance.
*
* @param array $credentials
* @param bool $remember
+ * @param string $guard
* @return void
*/
- public function __construct($credentials, $remember)
+ public function __construct($credentials, $remember, $guard)
{
$this->remember = $remember;
$this->credentials = $credentials;
+ $this->guard = $guard;
}
} | true |
Other | laravel | framework | 69cddedae349956c5f38455e861e3fc490d89a07.json | Add guard to authentication events | src/Illuminate/Auth/Events/Authenticated.php | @@ -15,14 +15,23 @@ class Authenticated
*/
public $user;
+ /**
+ * The guard the user is authenticating to.
+ *
+ * @var string
+ */
+ public $guard;
+
/**
* Create a new event instance.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
+ * @param string $guard
* @return void
*/
- public function __construct($user)
+ public function __construct($user, $guard)
{
$this->user = $user;
+ $this->guard = $guard;
}
} | true |
Other | laravel | framework | 69cddedae349956c5f38455e861e3fc490d89a07.json | Add guard to authentication events | src/Illuminate/Auth/Events/Failed.php | @@ -18,16 +18,25 @@ class Failed
*/
public $credentials;
+ /**
+ * The guard the user failed to authenticated to.
+ *
+ * @var string
+ */
+ public $guard;
+
/**
* Create a new event instance.
*
* @param \Illuminate\Contracts\Auth\Authenticatable|null $user
* @param array $credentials
+ * @param string $guard
* @return void
*/
- public function __construct($user, $credentials)
+ public function __construct($user, $credentials, $guard)
{
$this->user = $user;
$this->credentials = $credentials;
+ $this->guard = $guard;
}
} | true |
Other | laravel | framework | 69cddedae349956c5f38455e861e3fc490d89a07.json | Add guard to authentication events | src/Illuminate/Auth/Events/Login.php | @@ -22,16 +22,25 @@ class Login
*/
public $remember;
+ /**
+ * The guard the user authenticated to.
+ *
+ * @var string
+ */
+ public $guard;
+
/**
* Create a new event instance.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param bool $remember
+ * @param string $guard
* @return void
*/
- public function __construct($user, $remember)
+ public function __construct($user, $remember, $guard)
{
$this->user = $user;
$this->remember = $remember;
+ $this->guard = $guard;
}
} | true |
Other | laravel | framework | 69cddedae349956c5f38455e861e3fc490d89a07.json | Add guard to authentication events | src/Illuminate/Auth/Events/Logout.php | @@ -15,14 +15,23 @@ class Logout
*/
public $user;
+ /**
+ * The guard to which the user was authenticated.
+ *
+ * @var string
+ */
+ public $guard;
+
/**
* Create a new event instance.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
+ * @param string $guard
* @return void
*/
- public function __construct($user)
+ public function __construct($user, $guard)
{
$this->user = $user;
+ $this->guard = $guard;
}
} | true |
Other | laravel | framework | 69cddedae349956c5f38455e861e3fc490d89a07.json | Add guard to authentication events | src/Illuminate/Auth/SessionGuard.php | @@ -493,7 +493,7 @@ public function logout()
}
if (isset($this->events)) {
- $this->events->dispatch(new Events\Logout($user));
+ $this->events->dispatch(new Events\Logout($user, $this->name));
}
// Once we have fired the logout event we will clear the users out of memory
@@ -576,7 +576,7 @@ protected function fireAttemptEvent(array $credentials, $remember = false)
{
if (isset($this->events)) {
$this->events->dispatch(new Events\Attempting(
- $credentials, $remember
+ $credentials, $remember, $this->name
));
}
}
@@ -591,7 +591,9 @@ protected function fireAttemptEvent(array $credentials, $remember = false)
protected function fireLoginEvent($user, $remember = false)
{
if (isset($this->events)) {
- $this->events->dispatch(new Events\Login($user, $remember));
+ $this->events->dispatch(new Events\Login(
+ $user, $remember, $this->name
+ ));
}
}
@@ -604,7 +606,9 @@ protected function fireLoginEvent($user, $remember = false)
protected function fireAuthenticatedEvent($user)
{
if (isset($this->events)) {
- $this->events->dispatch(new Events\Authenticated($user));
+ $this->events->dispatch(new Events\Authenticated(
+ $user, $this->name
+ ));
}
}
@@ -618,7 +622,9 @@ protected function fireAuthenticatedEvent($user)
protected function fireFailedEvent($user, array $credentials)
{
if (isset($this->events)) {
- $this->events->dispatch(new Events\Failed($user, $credentials));
+ $this->events->dispatch(new Events\Failed(
+ $user, $credentials, $this->name
+ ));
}
}
| true |
Other | laravel | framework | a02877f4a610cdc546787b3f40c697778d4c4ae7.json | Fix MorphTo lazy eager loading (#25252) | src/Illuminate/Database/Eloquent/Builder.php | @@ -543,7 +543,7 @@ public function getRelation($name)
// and error prone. We don't want constraints because we add eager ones.
$relation = Relation::noConstraints(function () use ($name) {
try {
- return $this->getModel()->{$name}();
+ return $this->getModel()->newInstance()->$name();
} catch (BadMethodCallException $e) {
throw RelationNotFoundException::make($this->getModel(), $name);
} | true |
Other | laravel | framework | a02877f4a610cdc546787b3f40c697778d4c4ae7.json | Fix MorphTo lazy eager loading (#25252) | tests/Database/DatabaseEloquentBuilderTest.php | @@ -460,7 +460,7 @@ public function testGetRelationProperlySetsNestedRelationships()
{
$builder = $this->getBuilder();
$builder->setModel($this->getMockModel());
- $builder->getModel()->shouldReceive('orders')->once()->andReturn($relation = m::mock('stdClass'));
+ $builder->getModel()->shouldReceive('newInstance->orders')->once()->andReturn($relation = m::mock('stdClass'));
$relationQuery = m::mock('stdClass');
$relation->shouldReceive('getQuery')->andReturn($relationQuery);
$relationQuery->shouldReceive('with')->once()->with(['lines' => null, 'lines.details' => null]);
@@ -473,8 +473,8 @@ public function testGetRelationProperlySetsNestedRelationshipsWithSimilarNames()
{
$builder = $this->getBuilder();
$builder->setModel($this->getMockModel());
- $builder->getModel()->shouldReceive('orders')->once()->andReturn($relation = m::mock('stdClass'));
- $builder->getModel()->shouldReceive('ordersGroups')->once()->andReturn($groupsRelation = m::mock('stdClass'));
+ $builder->getModel()->shouldReceive('newInstance->orders')->once()->andReturn($relation = m::mock('stdClass'));
+ $builder->getModel()->shouldReceive('newInstance->ordersGroups')->once()->andReturn($groupsRelation = m::mock('stdClass'));
$relationQuery = m::mock('stdClass');
$relation->shouldReceive('getQuery')->andReturn($relationQuery); | true |
Other | laravel | framework | a02877f4a610cdc546787b3f40c697778d4c4ae7.json | Fix MorphTo lazy eager loading (#25252) | tests/Integration/Database/EloquentMorphToLazyEagerLoadingTest.php | @@ -0,0 +1,94 @@
+<?php
+
+namespace Illuminate\Tests\Integration\Database\EloquentMorphToLazyEagerLoadingTest;
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Tests\Integration\Database\DatabaseTestCase;
+
+/**
+ * @group integration
+ */
+class EloquentMorphToLazyEagerLoadingTest extends DatabaseTestCase
+{
+ public function setUp()
+ {
+ parent::setUp();
+
+ Schema::create('users', function (Blueprint $table) {
+ $table->increments('id');
+ });
+
+ Schema::create('posts', function (Blueprint $table) {
+ $table->increments('post_id');
+ $table->unsignedInteger('user_id');
+ });
+
+ Schema::create('videos', function (Blueprint $table) {
+ $table->increments('video_id');
+ });
+
+ Schema::create('comments', function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('commentable_type');
+ $table->integer('commentable_id');
+ });
+
+ $user = User::create();
+
+ $post = tap((new Post)->user()->associate($user))->save();
+
+ $video = Video::create();
+
+ (new Comment)->commentable()->associate($post)->save();
+ (new Comment)->commentable()->associate($video)->save();
+ }
+
+ public function test_lazy_eager_loading()
+ {
+ $comments = Comment::all();
+
+ \DB::enableQueryLog();
+
+ $comments->load('commentable');
+
+ $this->assertCount(3, \DB::getQueryLog());
+ $this->assertTrue($comments[0]->relationLoaded('commentable'));
+ $this->assertTrue($comments[0]->commentable->relationLoaded('user'));
+ $this->assertTrue($comments[1]->relationLoaded('commentable'));
+ }
+}
+
+class Comment extends Model
+{
+ public $timestamps = false;
+
+ public function commentable()
+ {
+ return $this->morphTo();
+ }
+}
+
+class Post extends Model
+{
+ public $timestamps = false;
+ protected $primaryKey = 'post_id';
+ protected $with = ['user'];
+
+ public function user()
+ {
+ return $this->belongsTo(User::class);
+ }
+}
+
+class User extends Model
+{
+ public $timestamps = false;
+}
+
+class Video extends Model
+{
+ public $timestamps = false;
+ protected $primaryKey = 'video_id';
+} | true |
Other | laravel | framework | ad670c8423a5fdfc929644f63db1b7ca39a8ba59.json | Inform user when a `cache:clear` command fails | src/Illuminate/Cache/Console/ClearCommand.php | @@ -64,7 +64,9 @@ public function handle()
'cache:clearing', [$this->argument('store'), $this->tags()]
);
- $this->cache()->flush();
+ if (! $this->cache()->flush()) {
+ return $this->error('Failed to clear cache. Make sure you have appropriate rights.');
+ }
$this->flushFacades();
| false |
Other | laravel | framework | ef2dc2e7ccbcb3d074e81c552e35df36a6fc25e6.json | Fix MorphTo lazy eager loading (#25240) | src/Illuminate/Database/Eloquent/Builder.php | @@ -543,7 +543,7 @@ public function getRelation($name)
// and error prone. We don't want constraints because we add eager ones.
$relation = Relation::noConstraints(function () use ($name) {
try {
- return $this->getModel()->{$name}();
+ return $this->getModel()->newInstance()->$name();
} catch (BadMethodCallException $e) {
throw RelationNotFoundException::make($this->getModel(), $name);
} | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.