Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Sets access and modification time of file
<?php touch(string $filename, ?int $mtime = null, ?int $atime = null): bool
<?php     {

        $filename = '/statamic-test-'.time();

        $tmp = $path.$filename;

        touch($tmp);



        $resolvedUrl = URL::assemble($this->getAbsoluteUrl($url), $filename);
<?php         $file = UploadedFile::fake()->image('image.jpg', 30, 60); // creates a 723 byte image

        Storage::disk('test')->putFileAs('foo', $file, 'image.jpg');

        $realFilePath = Storage::disk('test')->getAdapter()->getPathPrefix().'foo/image.jpg';

        touch($realFilePath, $timestamp = Carbon::now()->subMinutes(3)->timestamp);



        $container = tap(AssetContainer::make('test')->disk('test'))->save();

        $asset = $container->makeAsset('foo/image.jpg');
<?php         Storage::disk('disk_short')->putFileAs('foo', $file, 'image_in_short.jpg');

        $realFilePath = Storage::disk('disk_short')->getAdapter()->getPathPrefix().'foo/image_in_short.jpg';

        touch($realFilePath, $timestamp = Carbon::now()->subMinutes(3)->timestamp);



        $containerShortUrl = tap(AssetContainer::make('container_short')->disk('disk_short'))->save();

        $assetShortUrl = $containerShortUrl->makeAsset('foo/image_in_short.jpg');
<?php         Storage::disk('disk_long')->putFileAs('foo', $file, 'image_in_long.jpg');

        $realFilePath = Storage::disk('disk_long')->getAdapter()->getPathPrefix().'foo/image_in_long.jpg';

        touch($realFilePath, $timestamp = Carbon::now()->subMinutes(3)->timestamp);



        $containerLongUrl = tap(AssetContainer::make('container_long')->disk('disk_long'))->save();

        $assetLongUrl = $containerLongUrl->makeAsset('foo/image_in_long.jpg');
<?php     {

        Carbon::setTestNow('2017-01-02 14:35:00');

        Storage::disk('test')->put('test.txt', '');

        touch(

            Storage::disk('test')->getAdapter()->getPathPrefix().'test.txt',

            Carbon::now()->timestamp

        );



        $asset = (new Asset)->container($this->container)->path('test.txt');
<?php         $file = UploadedFile::fake()->image('image.jpg', 30, 60); // creates a 723 byte image

        Storage::disk('test')->putFileAs('foo', $file, 'image.jpg');

        $realFilePath = Storage::disk('test')->getAdapter()->getPathPrefix().'foo/image.jpg';

        touch($realFilePath, Carbon::now()->subMinutes(3)->timestamp);



        $container = Facades\AssetContainer::make('test')->disk('test');

        Facades\AssetContainer::shouldReceive('findByHandle')->with('test')->andReturn($container);
<?php         $file = UploadedFile::fake()->image('image.jpg', 30, 60); // creates a 723 byte image

        Storage::disk('test')->putFileAs('foo', $file, 'image.jpg');

        $realFilePath = Storage::disk('test')->getAdapter()->getPathPrefix().'foo/image.jpg';

        touch($realFilePath, $timestamp = Carbon::parse('2021-02-22 09:41:42')->timestamp);



        $container = Facades\AssetContainer::make('test')->disk('test');

        $asset = (new Asset)->container($container)->path('foo/image.jpg');
<?php         $path = $entry->path();

        $date = Carbon::parse('2017-01-02');

        mkdir(dirname($path));

        touch($path, $date->timestamp);



        $this->assertTrue($date->eq($entry->lastModified()));
<?php         $file = UploadedFile::fake()->image('image.jpg', 30, 60); // creates a 723 byte image

        Storage::disk('test')->putFileAs('sub', $file, 'image.jpg');

        $realFilePath = Storage::disk('test')->getAdapter()->getPathPrefix().'sub/image.jpg';

        touch($realFilePath, Carbon::now()->subMinutes(3)->timestamp);

        AssetContainer::make('test')->disk('test')->title('Test')->save();



        $query = <<<'GQL'
<?php     public function gets_last_modified()

    {

        file_put_contents($this->tempDir.'/filename.txt', 'Hello World');

        touch($this->tempDir.'/filename.txt', $time = 1512160249);

        $this->assertEquals($time, $this->adapter->lastModified('filename.txt'));

    }
<?php         app('files')->deleteDirectory($this->fakeStacheDirectory);



        mkdir($this->fakeStacheDirectory);

        touch($this->fakeStacheDirectory.'/.gitkeep');

    }

}
<?php     public function it_gets_yaml_files()

    {

        touch($this->tempDir.'/one.yaml', 1234567890);

        touch($this->tempDir.'/two.yaml', 1234567890);

        touch($this->tempDir.'/three.txt', 1234567890);

        mkdir($this->tempDir.'/subdirectory');
<?php     public function it_gets_yaml_files()

    {

        touch($this->tempDir.'/one.yaml', 1234567890);

        touch($this->tempDir.'/two.yaml', 1234567890);

        touch($this->tempDir.'/three.txt', 1234567890);

        mkdir($this->tempDir.'/subdirectory');

        touch($this->tempDir.'/subdirectory/nested-one.yaml', 1234567890);
<?php     {

        touch($this->tempDir.'/one.yaml', 1234567890);

        touch($this->tempDir.'/two.yaml', 1234567890);

        touch($this->tempDir.'/three.txt', 1234567890);

        mkdir($this->tempDir.'/subdirectory');

        touch($this->tempDir.'/subdirectory/nested-one.yaml', 1234567890);

        touch($this->tempDir.'/subdirectory/nested-two.yaml', 1234567890);
<?php         touch($this->tempDir.'/two.yaml', 1234567890);

        touch($this->tempDir.'/three.txt', 1234567890);

        mkdir($this->tempDir.'/subdirectory');

        touch($this->tempDir.'/subdirectory/nested-one.yaml', 1234567890);

        touch($this->tempDir.'/subdirectory/nested-two.yaml', 1234567890);



        $files = Traverser::filter([$this->store, 'getItemFilter'])->traverse($this->store);