for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Angecode\LaravelFullName\Traits;
use Illuminate\Support\Collection;
use Illuminate\Filesystem\Filesystem;
/**
* Trait CanPublish.
*
* @property $app
* @@codeCoverageIgnore
*/
trait CanPublish
{
* Returns existing migration file if found, else uses the current timestamp.
* @param Filesystem $filesystem
* @return string
protected function getMigrationFileName(Filesystem $filesystem): string
$timestamp = date('Y_m_d_His');
return Collection::make($this->app->databasePath().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR)
app
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
->flatMap(function ($path) use ($filesystem) {
return $filesystem->glob($path.'*_add_fullname_to_users_table.php');
})->push($this->app->databasePath()."/migrations/{$timestamp}_add_fullname_to_users_table.php")
->first();
}
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: