change default currency rate
This commit is contained in:
parent
668e12c0fa
commit
7c38c1890d
@ -6,6 +6,7 @@ use App\Abstracts\Http\Controller;
|
||||
use App\Http\Requests\Setting\Setting as Request;
|
||||
use App\Models\Common\Company;
|
||||
use App\Models\Module\Module;
|
||||
use App\Models\Setting\Currency;
|
||||
use App\Traits\DateTime;
|
||||
use App\Traits\Uploads;
|
||||
use App\Utilities\Installer;
|
||||
@ -113,6 +114,12 @@ class Settings extends Controller
|
||||
user()->setAttribute('locale', $value)->save();
|
||||
}
|
||||
|
||||
if ($real_key == 'default.currency') {
|
||||
$currency = Currency::code($value)->first();
|
||||
$currency->rate = '1';
|
||||
$currency->save();
|
||||
}
|
||||
|
||||
// If only 1 company
|
||||
if ($total_companies == 1) {
|
||||
$this->oneCompany($real_key, $value);
|
||||
|
@ -148,4 +148,16 @@ class Currency extends Model
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope currency by code.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param mixed $code
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeCode($query, $code)
|
||||
{
|
||||
return $query->where($this->table . '.code', $code);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user