✨Virtue
Extend the Laravel Framework with a collection of attributes
Last updated
Extend the Laravel Framework with a collection of attributes
Last updated
use Illuminate\Database\Eloquent\Model;
use WendellAdriel\Virtue\Models\Attributes\Database;
use WendellAdriel\Virtue\Models\Attributes\PrimaryKey;
use WendellAdriel\Virtue\Models\Concerns\Virtue;
#[Database(connection: 'pgsql', table: 'custom_products', timestamps: false)]
#[PrimaryKey(name: 'uuid', type: 'string', incrementing: false)]
#[BelongsTo(Store::class)]
final class Product extends Model
{
use Virtue;
}use Illuminate\Console\Command;
use WendellAdriel\Virtue\Commands\Attributes\FlagOption;
use WendellAdriel\Virtue\Commands\Attributes\OptionalArgument;
use WendellAdriel\Virtue\Commands\Attributes\RequiredArgument;
use WendellAdriel\Virtue\Commands\Concerns\Virtue;
#[RequiredArgument(name: 'name')]
#[OptionalArgument(name: 'age', default: 18)]
#[FlagOption(name: 'scores-only', shortcut: 's')]
final class TestCommand extends Command
{
use Virtue;
protected $name = 'app:test';
protected $description = 'Command description';
public function handle()
{
// Command code here
}
}