Code Monkey home page Code Monkey logo

laravel-config's Issues

publish the LaravelConfig class and the Model

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

the new cast funchon brakes laravel-ide-helper ide-helper:models

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() 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.