The
now
function creates a new Illuminate\Support\Carbon
instance for the current time:<?php $now = now();
<?php $environmentLastModified = $hasEnvironment
? filemtime($environmentFile)
: now()->addDays(30)->getTimestamp();
$process = $this->startProcess($hasEnvironment);
<?php public function handle()
{
$this->publishedAt = now();
$this->determineWhatShouldBePublished();
<?php public function markAsFinished(string $batchId)
{
if (isset($this->batches[$batchId])) {
$this->batches[$batchId]->finishedAt = now();
}
}
<?php $batch = $this->createTestBatch($queue);
$this->assertFalse($batch->finished());
$batch->finishedAt = now();
$this->assertTrue($batch->finished());
$batch->options['progress'] = [];
<?php $this->assertTrue($batch->hasCatchCallbacks());
$this->assertFalse($batch->cancelled());
$batch->cancelledAt = now();
$this->assertTrue($batch->cancelled());
$this->assertIsString(json_encode($batch));
<?php 'failed_jobs' => '',
'failed_job_ids' => '[]',
'options' => $serialize,
'created_at' => now()->timestamp,
'cancelled_at' => null,
'finished_at' => null,
]);
<?php public function testAvailableInReturnsPositiveValues()
{
$cache = m::mock(Cache::class);
$cache->shouldReceive('get')->andReturn(now()->subSeconds(60)->getTimestamp(), null);
$rateLimiter = new RateLimiter($cache);
$this->assertTrue($rateLimiter->availableIn('key:timer') >= 0);
<?php 'published_at' => 'max',
'id' => 'max',
], function ($q) {
$q->where('published_at', '<', now());
});
}
<?php 'published_at' => 'max',
'id' => 'max',
], function ($q) {
$q->where('published_at', '<', now());
});
}
<?php public function testThrowsExceptionIfCastableAttributeWasNotRetrievedAndPreventMissingAttributesIsEnabled()
{
Time::create(['time' => now()]);
$originalMode = Model::preventsAccessingMissingAttributes();
Model::preventAccessingMissingAttributes();
<?php $this->assertEquals([], $builder->getBindings());
$builder = $this->getBuilder();
$period = now()->startOfDay()->toPeriod(now()->addDay()->startOfDay());
$builder->select('*')->from('users')->whereBetween('created_at', $period);
$this->assertSame('select * from "users" where "created_at" between ? and ?', $builder->toSql());
$this->assertEquals([now()->startOfDay(), now()->addDay()->startOfDay()], $builder->getBindings());
<?php $period = now()->startOfDay()->toPeriod(now()->addDay()->startOfDay());
$builder->select('*')->from('users')->whereBetween('created_at', $period);
$this->assertSame('select * from "users" where "created_at" between ? and ?', $builder->toSql());
$this->assertEquals([now()->startOfDay(), now()->addDay()->startOfDay()], $builder->getBindings());
$builder = $this->getBuilder();
<?php $builder = $this->getBuilder();
$period = now()->startOfDay()->toPeriod(now()->addMonth()->startOfDay());
$builder->select('*')->from('users')->whereBetween('created_at', $period);
$this->assertSame('select * from "users" where "created_at" between ? and ?', $builder->toSql());
$this->assertEquals([now()->startOfDay(), now()->addMonth()->startOfDay()], $builder->getBindings());
<?php $period = now()->startOfDay()->toPeriod(now()->addMonth()->startOfDay());
$builder->select('*')->from('users')->whereBetween('created_at', $period);
$this->assertSame('select * from "users" where "created_at" between ? and ?', $builder->toSql());
$this->assertEquals([now()->startOfDay(), now()->addMonth()->startOfDay()], $builder->getBindings());
$builder = $this->getBuilder();
$builder->select('*')->from('users')->whereBetween('id', collect([1, 2]));
<?php public function testCursorPaginateWithUnionWheres()
{
$ts = now()->toDateTimeString();
$perPage = 16;
$columns = ['test'];