tarfin-labs / laravel-config Goto Github PK
View Code? Open in Web Editor NEWKey value config management for Laravel
License: MIT License
Key value config management for Laravel
License: MIT License
Publishing factories is not necessery since Laravel v6.12.0. So they can be loaded from package like models.
#31133
hey i love this package but i want to be able to add traits to the Model such as SoftDeletes , auditing , and caching
i also want to be able to add/edit the functions used for adding/changing the keypairs wethere its updating the description by id or disable caching on some functions or get the audit results i think the LaravelConfig class would work better if it was a trait of the Model and the Model was publishable then it would be easy to add or change any of the functions
i found that if you change src/Casts/ConfigValueCast.php line 12 and line 24 from
line 12:
public function get(Model $model, string $key, mixed $value, array $attributes)
to:
public function get($model, string $key, mixed $value, array $attributes)
and line 24 from:
public function set(Model $model, string $key, mixed $value, array $attributes)
to:
public function set($model, string $key, mixed $value, array $attributes)
it works fixing all the problems
this is the error
Symfony\Component\ErrorHandler\Error\FatalError
Declaration of TarfinLabs\LaravelConfig\Casts\ConfigValueCast::get(Illuminate\Database\Eloquent\Model $model, string $key, $value, array $attributes) must be compatible with Illuminate\Contracts\Database\Eloquent\CastsAttributes::get($model, string $key, $value, array $attributes)
at vendor/tarfin-labs/laravel-config/src/Casts/ConfigValueCast.php:12
8▕ use TarfinLabs\LaravelConfig\Enums\ConfigDataType;
9▕
10▕ class ConfigValueCast implements CastsAttributes
11▕ {
➜ 12▕ public function get(Model $model, string $key, $value, array $attributes)
13▕ {
14▕ return match ($attributes['type']) {
15▕ ConfigDataType::BOOLEAN->value => (bool) $value,
16▕ ConfigDataType::INTEGER->value => (int) $value,
vendor frames
5 artisan:0
{main}()
Whoops\Exception\ErrorException
Declaration of TarfinLabs\LaravelConfig\Casts\ConfigValueCast::get(Illuminate\Database\Eloquent\Model $model, string $key, $value, array $attributes) must be compatible with Illuminate\Contracts\Database\Eloquent\CastsAttributes::get($model, string $key, $value, array $attributes)
at vendor/tarfin-labs/laravel-config/src/Casts/ConfigValueCast.php:12
8▕ use TarfinLabs\LaravelConfig\Enums\ConfigDataType;
9▕
10▕ class ConfigValueCast implements CastsAttributes
11▕ {
➜ 12▕ public function get(Model $model, string $key, $value, array $attributes)
13▕ {
14▕ return match ($attributes['type']) {
15▕ ConfigDataType::BOOLEAN->value => (bool) $value,
16▕ ConfigDataType::INTEGER->value => (int) $value,
vendor frames
2 [internal]:0
Whoops\Run::handleShutdown()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.