Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: laravel/framework
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.18.1
Choose a base ref
...
head repository: laravel/framework
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.18.2
Choose a head ref
  • 10 commits
  • 12 files changed
  • 4 contributors

Commits on Mar 11, 2020

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    cf71f81 View commit details
  2. formatting

    taylorotwell committed Mar 11, 2020
    1
    Copy the full SHA
    93763c7 View commit details

Commits on Mar 12, 2020

  1. Fixed error

    GrahamCampbell committed Mar 12, 2020

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    e2a1b89 View commit details
  2. Removed stupid doc

    GrahamCampbell committed Mar 12, 2020

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    23e1eec View commit details
  3. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    bb0ec42 View commit details

Commits on Mar 13, 2020

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    d98103e View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9d2faf5 View commit details
  3. Merge branch 'unset-pivot-relation' of https://github.com/23G/framework

    … into 23G-unset-pivot-relation
    taylorotwell committed Mar 13, 2020
    Copy the full SHA
    2b600ce View commit details

Commits on Mar 15, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    07f225a View commit details

Commits on Mar 17, 2020

  1. patch version

    taylorotwell committed Mar 17, 2020
    Copy the full SHA
    9425a2f View commit details
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@
"ext-memcached": "Required to use the memcache cache driver.",
"ext-pcntl": "Required to use all features of the queue worker.",
"ext-posix": "Required to use all features of the queue worker.",
"ext-redis": "Required to use the Redis cache and queue drivers.",
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).",
"filp/whoops": "Required for friendly error pages in development (^2.4).",
2 changes: 0 additions & 2 deletions src/Illuminate/Bus/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -140,8 +140,6 @@ protected function commandShouldBeQueued($command)
*
* @param mixed $command
* @return mixed
*
* @throws \RuntimeException
*/
public function dispatchToQueue($command)
{
83 changes: 78 additions & 5 deletions src/Illuminate/Console/Scheduling/Schedule.php
Original file line number Diff line number Diff line change
@@ -2,12 +2,17 @@

namespace Illuminate\Console\Scheduling;

use Closure;
use DateTimeInterface;
use Illuminate\Console\Application;
use Illuminate\Container\Container;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\CallQueuedClosure;
use Illuminate\Support\ProcessUtils;
use Illuminate\Support\Traits\Macroable;
use RuntimeException;

class Schedule
{
@@ -41,6 +46,13 @@ class Schedule
*/
protected $timezone;

/**
* The job dispatcher implementation.
*
* @var \Illuminate\Contracts\Bus\Dispatcher
*/
protected $dispatcher;

/**
* Create a new schedule instance.
*
@@ -51,6 +63,12 @@ public function __construct($timezone = null)
{
$this->timezone = $timezone;

if (! class_exists(Container::class)) {
throw new RuntimeException(
'A container implementation is required to use the scheduler. Please install illuminate/container.'
);
}

$container = Container::getInstance();

$this->eventMutex = $container->bound(EventMutex::class)
@@ -107,18 +125,52 @@ public function command($command, array $parameters = [])
public function job($job, $queue = null, $connection = null)
{
return $this->call(function () use ($job, $queue, $connection) {
$job = is_string($job) ? resolve($job) : $job;
$job = is_string($job) ? Container::getInstance()->make($job) : $job;

if ($job instanceof ShouldQueue) {
dispatch($job)
->onConnection($connection ?? $job->connection)
->onQueue($queue ?? $job->queue);
$this->dispatchToQueue($job, $queue ?? $job->queue, $connection ?? $job->connection);
} else {
dispatch_now($job);
$this->dispatchNow($job);
}
})->name(is_string($job) ? $job : get_class($job));
}

/**
* Dispatch the given job to the queue.
*
* @param object $job
* @param string|null $queue
* @param string|null $connection
* @return void
*/
protected function dispatchToQueue($job, $queue, $connection)
{
if ($job instanceof Closure) {
if (! class_exists(CallQueuedClosure::class)) {
throw new RuntimeException(
'To enable support for closure jobs, please install illuminate/queue.'
);
}

$job = CallQueuedClosure::create($job);
}

$this->getDispatcher()->dispatch(
$job->onConnection($connection)->onQueue($queue)
);
}

/**
* Dispatch the given job right now.
*
* @param object $job
* @return void
*/
protected function dispatchNow($job)
{
$this->getDispatcher()->dispatchNow($job);
}

/**
* Add a new command event to the schedule.
*
@@ -209,4 +261,25 @@ public function useCache($store)

return $this;
}

/**
* Get the job dispatcher, if available.
*
* @return \Illuminate\Contracts\Bus\Dispatcher
*/
protected function getDispatcher()
{
if ($this->dispatcher === null) {
try {
$this->dispatcher = Container::getInstance()->make(Dispatcher::class);
} catch (BindingResolutionException $e) {
throw new RuntimeException(
'Unable to resolve the dispatcher from the service container. Please bind it or install illuminate/bus.',
$e->getCode(), $e
);
}
}

return $this->dispatcher;
}
}
7 changes: 5 additions & 2 deletions src/Illuminate/Console/composer.json
Original file line number Diff line number Diff line change
@@ -31,9 +31,12 @@
}
},
"suggest": {
"dragonmantank/cron-expression": "Required to use scheduling component (^2.0).",
"dragonmantank/cron-expression": "Required to use scheduler (^2.0).",
"guzzlehttp/guzzle": "Required to use the ping methods on schedules (^6.0|^7.0).",
"illuminate/filesystem": "Required to use the generator command (^6.0)"
"illuminate/bus": "Required to use the scheduled job dispatcher (^6.0)",
"illuminate/container": "Required to use the scheduler (^6.0)",
"illuminate/filesystem": "Required to use the generator command (^6.0)",
"illuminate/queue": "Required to use closures for scheduled jobs (^6.0)"
},
"config": {
"sort-packages": true
13 changes: 13 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php
Original file line number Diff line number Diff line change
@@ -301,4 +301,17 @@ protected function newQueryForCollectionRestoration(array $ids)

return $query;
}

/**
* Unset all the loaded relations for the instance.
*
* @return $this
*/
public function unsetRelations()
{
$this->pivotParent = null;
$this->relations = [];

return $this;
}
}
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
const VERSION = '6.18.1';
const VERSION = '6.18.2';

/**
* The base path for the Laravel installation.
7 changes: 3 additions & 4 deletions src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@
use Illuminate\Foundation\Mix;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Queue\CallQueuedClosure;
use Illuminate\Queue\SerializableClosure;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\HtmlString;
use Symfony\Component\Debug\Exception\FatalThrowableError;
@@ -300,13 +299,13 @@ function config_path($path = '')
* @param int $minutes
* @param string|null $path
* @param string|null $domain
* @param bool $secure
* @param bool|null $secure
* @param bool $httpOnly
* @param bool $raw
* @param string|null $sameSite
* @return \Illuminate\Cookie\CookieJar|\Symfony\Component\HttpFoundation\Cookie
*/
function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true, $raw = false, $sameSite = null)
function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null)
{
$cookie = app(CookieFactory::class);

@@ -387,7 +386,7 @@ function decrypt($value, $unserialize = true)
function dispatch($job)
{
if ($job instanceof Closure) {
$job = new CallQueuedClosure(new SerializableClosure($job));
$job = CallQueuedClosure::create($job);
}

return new PendingDispatch($job);
12 changes: 12 additions & 0 deletions src/Illuminate/Queue/CallQueuedClosure.php
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

namespace Illuminate\Queue;

use Closure;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Queue\ShouldQueue;
@@ -37,6 +38,17 @@ public function __construct(SerializableClosure $closure)
$this->closure = $closure;
}

/**
* Create a new job instance.
*
* @param \Closure $closure
* @return self
*/
public static function create(Closure $job)
{
return new self(new SerializableClosure($job));
}

/**
* Execute the job.
*
2 changes: 1 addition & 1 deletion src/Illuminate/Redis/composer.json
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
}
},
"suggest": {
"ext-redis": "Required to use the phpredis connector (^4.0).",
"ext-redis": "Required to use the phpredis connector (^4.0|^5.0).",
"predis/predis": "Required to use the predis connector (^1.0)."
},
"extra": {
2 changes: 2 additions & 0 deletions src/Illuminate/Support/Facades/Redis.php
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@

/**
* @method static \Illuminate\Redis\Connections\Connection connection(string $name = null)
* @method static \Illuminate\Redis\Limiters\ConcurrencyLimiterBuilder funnel(string $name)
* @method static \Illuminate\Redis\Limiters\DurationLimiterBuilder throttle(string $name)
*
* @see \Illuminate\Redis\RedisManager
* @see \Illuminate\Contracts\Redis\Factory
25 changes: 25 additions & 0 deletions tests/Database/DatabaseEloquentPivotTest.php
Original file line number Diff line number Diff line change
@@ -152,6 +152,31 @@ public function testPivotModelWithoutParentReturnsModelTimestampColumns()
$this->assertEquals($model->getCreatedAtColumn(), $pivotWithoutParent->getCreatedAtColumn());
$this->assertEquals($model->getUpdatedAtColumn(), $pivotWithoutParent->getUpdatedAtColumn());
}

public function testWithoutRelations()
{
$original = new Pivot();

$original->pivotParent = 'foo';
$original->setRelation('bar', 'baz');

$this->assertEquals('baz', $original->getRelation('bar'));

$pivot = $original->withoutRelations();

$this->assertInstanceOf(Pivot::class, $pivot);
$this->assertNotSame($pivot, $original);
$this->assertEquals('foo', $original->pivotParent);
$this->assertNull($pivot->pivotParent);
$this->assertTrue($original->relationLoaded('bar'));
$this->assertFalse($pivot->relationLoaded('bar'));

$pivot = $original->unsetRelations();

$this->assertSame($pivot, $original);
$this->assertNull($pivot->pivotParent);
$this->assertFalse($pivot->relationLoaded('bar'));
}
}

class DatabaseEloquentPivotTestDateStub extends Pivot
1 change: 1 addition & 0 deletions tests/Integration/Console/JobSchedulingTest.php
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

use Illuminate\Bus\Queueable;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Container\Container;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Queue;