Setting.php 430 B

1234567891011121314151617181920
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Setting extends Model
  5. {
  6. public $timestamps = false;
  7. public static function getSettings($key = null){
  8. $settings = $key ? self::where('key', $key)->first() : self::get();
  9. $collect = collect();
  10. foreach ($settings as $setting){
  11. $collect->put($setting->key, $setting->value);
  12. }
  13. return $collect;
  14. }
  15. }