Closed jorgemudry closed 3 years ago
It adds the make:cast command.
make:cast
composer.json
"require": { "php": "^7.3|^8.0", "laravel/lumen-framework": "^8.0", "flipbox/lumen-generator": "dev-feature_add_make_cast_command" }, "repositories": [ { "type": "vcs", "url": "https://github.com/jorgemudry/lumen-generator" } ]
$ composer update flipbox/lumen-generator;
$ php artisan make:cast MyCast
MyCast.php
app/Casts
<?php namespace App\Casts; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; class MyCast implements CastsAttributes { /** * Cast the given value. * * @param \Illuminate\Database\Eloquent\Model $model * @param string $key * @param mixed $value * @param array $attributes * @return mixed */ public function get($model, $key, $value, $attributes) { return $value; } /** * Prepare the given value for storage. * * @param \Illuminate\Database\Eloquent\Model $model * @param string $key * @param array $value * @param array $attributes * @return mixed */ public function set($model, $key, $value, $attributes) { return $value; } }
N/A
What does this Pull Request Do?
It adds the
make:cast
command.How should this be manually tested?
composer.json
file:make:cast
command:MyCast.php
class in yourapp/Casts
directory looking like this:Any background context you want to provide?
N/A
Any extra info?