123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace App\Distributor\Repositories;
- use App\Models\DistAdminDistributor as Model;
- use Dcat\Admin\Repositories\EloquentRepository;
- class DistAdminDistributor extends EloquentRepository
- {
-
- protected $eloquentClass = Model::class;
-
- public static function getInfo()
- {
- $id = getDistributorId();
- $row = Model::find($id);
- return $row;
- }
-
- public static function updateDomain($domainType,$customDomain)
- {
- $id = getDistributorId();
- $row = Model::find($id);
- $row->domain_type = $domainType;
- if ($domainType == 1) {
- $row->custom_domain = $customDomain;
- }
- $row->save();
- }
- public static function updateInfo($info)
- {
- $id = getDistributorId();
- $row = Model::find($id);
- $row->logo = $info['logo'];
- $row->site_name = $info['site_name'];
- $row->company_name = $info['company_name'];
- $row->company_address = $info['company_address'];
- $row->contact_number = $info['contact_number'];
- $row->service_hotline = $info['service_hotline'];
- $row->whats_app = $info['whats_app'];
- $row->facebook = $info['facebook'];
- $row->instagram = $info['instagram'];
- $row->youtube = $info['youtube'];
- $row->linkedin = $info['linkedin'];
- $row->tiktok = $info['tiktok'];
- $row->seo_title = $info['seo_title'];
- $row->seo_keywords = $info['seo_keywords'];
- $row->seo_description = $info['seo_description'];
- $row->save();
- }
-
- public static function enableTheme($appearanceId)
- {
- $appearanceId = intval($appearanceId);
- $distId = getDistributorId();
- $distAppearance = new DistAppearance();
- $appearanceRow = $distAppearance->model()->find($appearanceId);
- if ($appearanceRow && $appearanceRow->enabled == 1) {
-
- $row = Model::find($distId);
- $row->appearance_id = $appearanceId;
- $row->save();
-
- DistAppearance::switchTheme($appearanceId, $distId);
- return true;
- }
- return false;
- }
- }
|