/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //
     $template = ResponseTemplate::find($id);
     $usertypes = UserType::all()->lists('name', 'id');
     $triggers = [1 => 'Prospect Inquiry', 2 => 'Class Registration'];
     return view('admin.edit_response_template', ['title' => 'Create Response Templates', 'usertypes' => $usertypes, 'triggers' => $triggers, 'template' => $template]);
 }
Example #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $object = Model::find($id);
     if ($object) {
         $object->type = $object->type()->toArray();
         return view('admin.user.edit', ['input' => $object->toArray(), 'types' => UserType::all()]);
     }
     return redirect('admin/users');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     UserType::create(['name' => 'Contact']);
     UserType::create(['name' => 'Student']);
     UserType::create(['name' => 'Employee']);
     UserType::create(['name' => 'Buyer']);
     UserType::create(['name' => 'Seller']);
     UserType::create(['name' => 'Charter Guest']);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //
     $countries = \CountryState::getCountries();
     $states = \CountryState::getStates('US');
     $contact = User::find($id);
     $types = UserType::lists('name', 'id');
     empty($contact->country) ? $contact->country = 'US' : $contact->country;
     return view('contacts.edit', ['
         title' => 'Edit Contact: ' . $contact->fullname, 'contact' => $contact, 'states' => $states, 'countries' => $countries, 'types' => $types]);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $object = UserType::find($id);
     if ($object) {
         $params = $request->only('title', 'text');
         $filter = $object->validator($params, ['title' => 'required|min:2|max:25|unique:types,title,' . $id]);
         if ($filter->fails()) {
             $error = $filter->errors()->toArray();
             $params['id'] = $id;
             return view('admin.user-type.edit', ['input' => $params, 'error' => $error]);
         }
         $object->fill($params);
         $object->save();
         return view('admin.user-type.show', ['input' => $object->toArray()]);
     }
     return false;
 }
Example #6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $object = UserType::find($id);
     if ($object) {
         $params = $request->only('name', 'phone', 'email', 'type_id');
         $filter = $object->validator($params, ['email' => 'required|email|unique:users,email,' . $id]);
         if ($filter->fails()) {
             $error = $filter->errors()->toArray();
             $params['id'] = $id;
             return view('admin.trader.edit', ['input' => $params, 'error' => $error, 'options' => Option::where('user_id', $id)->get(), 'districts' => District::all(), 'brands' => Brand::all(), 'types' => UserType::all()]);
         }
         $object->fill($params);
         $object->save();
         return redirect('admin/trader/' . $id . '/edit');
     }
     if ($request->ajax()) {
         return $this->responseAnswer(false, null, null, trans('user.badUser'));
     } else {
         return redirect('admin/traders');
     }
 }
Example #7
0
	public static function getUserType($user_type_id)
	{
		$arr_usertypes= UserType::where('id',$user_type_id)->get()->toArray();
		return $arr_usertypes;
	}
 /**
  * Remove the specified resource from storage.
  *
  * @param  UserType  $type
  * @return \Illuminate\Http\Response
  */
 public function destroy(UserType $type)
 {
     if ($type->is_default) {
         return redirect()->back()->with('error', 'is-default');
     }
     try {
         $type->delete();
     } catch (QueryException $e) {
         return redirect()->back()->with('error', 'error-user-type');
     }
     return redirect(action('Admin\\UserTypesController@index'))->with('success', 'deleted');
 }
public function anyDeleteUserType($id)
   {
   		$arr_return = array('status' => 'error');
   		$usertype = UserType::find($id);
   		if($usertype->delete()){
   			$arr_return['status'] = 'success';
   		}else{
   			$arr_return['message'] = 'Delete fail';
   		}
   		return $arr_return;
}
 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]);
 }
 public function editUser($id)
 {
     $user = User::where('id', $id)->firstOrFail();
     $departments = Department::get();
     $userTypes = UserType::get();
     return view('displays.admin.editUser')->with('user', $user)->with('departments', $departments)->with('userTypes', $userTypes);
 }
 public function getUserTypes($active = false)
 {
     $types = UserType::with('access')->sort();
     return $active ? $types->active()->get() : $types->get();
 }