AppSetting.php 554 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Models;
  3. # use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Support\Facades\DB;
  5. class AppSetting extends Model
  6. {
  7. protected $table = 'app_setting';
  8. public static function getSetting($_key) {
  9. $setting = DB::select('SELECT * FROM app_setting WHERE key = ?', [$_key]);
  10. if(count($setting) > 0) {
  11. $setting = $setting[0];
  12. return $setting->value;
  13. }
  14. return null;
  15. }
  16. public function pro() {
  17. return $this->hasOne(Account::class, 'id', 'pro_id');
  18. }
  19. }