/**
  * 模块列表
  * @param boolean $all // 是否返回所有模块
  * @return array
  */
 public static function modulesOptions($all = false)
 {
     $options = [];
     if ($all === true) {
         $tenantModules = Tenant::modules();
     }
     $contentModels = ArrayHelper::getValue(Yii::$app->params, 'contentModules', []);
     foreach ($contentModels as $modelName => $item) {
         if ($all === false && in_array($modelName, $tenantModules)) {
             continue;
         }
         $options[$modelName] = Yii::t('app', $item['label']);
     }
     return $options;
 }
Esempio n. 2
0
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     \App\Models\Owner::saving(function ($owner) {
         if (empty($owner->owner_name)) {
             $owner->owner_name = null;
         }
         $owner->org_id = \Auth::User()->org_id;
         return $owner;
     });
     \App\Models\Property::saving(function ($property) {
         if (empty($property->property_name)) {
             $property->property_name = null;
         }
         $property->org_id = \Auth::User()->org_id;
         return $property;
     });
     \App\Models\Unit::saving(function ($unit) {
         if (empty($unit->unit_name)) {
             $unit->unit_name = null;
         }
         $unit->org_id = \Auth::User()->org_id;
         return $unit;
     });
     \App\Models\Tenant::saving(function ($tenant) {
         if (empty($tenant->tenant_name)) {
             $tenant->tenant_name = null;
         }
         $tenant->org_id = \Auth::User()->org_id;
         return $tenant;
     });
     \App\Models\Transaction::saving(function ($transaction) {
         $transaction->org_id = \Auth::User()->org_id;
         return $transaction;
     });
 }
Esempio n. 3
0
 /**
  *
  * @param $id
  * @return Response
  */
 public function destroy($id)
 {
     $transaction = Tenant::findOrFail($id);
     $transaction->delete();
     return \Response::json(['success' => true, 'message' => 'Tenant Deleted.', 'data' => []]);
 }