예제 #1
0
 public function templates($departments)
 {
     foreach ($departments as $department) {
         if (!isset($this->data['templates'][$department->id])) {
             $this->data['templates'][$department->id] = simpleSelect(EmailTemplate::where('system', 1)->where('department_id', $department->id)->get(), true);
         }
     }
     return $this->data['templates'];
 }
예제 #2
0
 public function templates()
 {
     $records = $templates = [];
     $records[] = ['' => trans('static.select')];
     if (request()->has('department_id')) {
         $templates = EmailTemplate::where('department_id', request()->get('department_id'))->where('system', 0)->get();
     }
     foreach ($templates as $template) {
         $records[] = [$template->id => $template->name];
     }
     return $records;
 }
 public function getEmail()
 {
     $departmentId = null;
     if ($this->systemAdmin) {
         if (session('department_filter_id')) {
             $departmentId = session('department_filter_id');
         }
     } else {
         $departmentId = auth()->user()->department_id;
     }
     $users = $templates = [];
     if ($departmentId) {
         $users = simpleSelect(User::where('department_id', $departmentId)->get());
         $templates = simpleSelect(EmailTemplate::where('department_id', $departmentId)->where('system', 0)->get(), true);
     }
     return view('admin.template.email', ['departments' => getNomenclatureSelect($this->getDepartmentsAdmin(), true), 'user_types' => simpleSelect(UserType::active()->get(), true, 'title'), 'users' => $users, 'templates' => $templates]);
 }