/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $input = $request->all();
     $department = new Department();
     $department->name = $input['name'];
     $department->save($request->all());
     return redirect('/departments');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $rule = ['department_name' => 'required | min:2', 'department_credit' => 'required', 'degree_id' => 'required'];
     $this->validate($request, $rule);
     $department = new Department($request->all());
     $department->save();
     return redirect('admin/department/create')->withStatus('Degree name saves successfully');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(DepartmentsFormRequest $request)
 {
     //
     $department = new Department();
     $department->name = $request->name;
     $department->save();
     return \Redirect::route('manage.departments.index', array($department->id))->with('success', 'Your department has been created!');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|unique:departments|max:255']);
     $dept = new Department();
     $dept->name = $request->name;
     $dept->save();
     flash()->success('Success!', 'Department created successfully');
     return redirect('/departments');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['txtName' => 'required', 'rActive' => 'required|in:0,1']);
     $dep = new Department();
     $dep->name = $request->txtName;
     $dep->active = $request->rActive;
     $dep->save();
     return redirect()->route('admin.department.listDep')->with('message', 'Create Department success!');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $departments = ['Unknown', 'City Administrator', 'Community Services', 'Corporate Services', 'Communications and Economic Development', 'Planning and Development', 'Public Safety', 'Public Works and Engineering'];
     foreach ($departments as $name) {
         $department = new Department();
         $department->active = true;
         $department->name = $name;
         $department->save();
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('departments')->delete();
     $department = new Department(['deptHeadId' => '1001', 'department' => 'Neurology']);
     $department->save();
     $department = new Department(['deptHeadId' => '1002', 'department' => 'Emergency Room']);
     $department->save();
     $department = new Department(['deptHeadId' => '1003', 'department' => 'ICU']);
     $department->save();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(DepartmentRequest $request)
 {
     $department = new Department();
     $department->name = $request['name'];
     $slug = preg_replace('/\\s+/', '-', $request['name']);
     $department->slug = $slug;
     $department->save();
     \Session::flash('success', $request['name'] . ' has been successfully added!');
     return redirect()->back();
 }
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['name' => 'required|max:50|unique:departments']);
     if ($validator->fails()) {
         return Redirect::to('/admin/department')->withErrors($validator)->withInput();
     }
     $department = new Department();
     $department->name = $request->name;
     $department->save();
     return Redirect::to('/admin/department');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|string']);
     $duplicate = Department::where('name', $request->name)->first();
     if ($duplicate) {
         return response()->json(true);
     }
     $department = new Department();
     $department->name = $request->name;
     $department->save();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(DepartmentRequest $request)
 {
     $department = new Department();
     $department->name = $request['name'];
     $department->acronym = $request['acronym'];
     $slug = preg_replace('/\\s+/', '-', $request['name']);
     $department->slug = $slug;
     $department->created_by = \Auth::user()->id;
     $department->save();
     \Session::flash('success', 'well done! Department ' . $request['name'] . ' has been successfully added!');
     return redirect()->back();
 }
 public function registerdepartment()
 {
     $messages = array('departmentcode.required' => 'Code is required', 'departmentcode.min' => 'Code must be at least 4 characters', 'departmentcode.unique' => 'This department is already registered', 'departmentcode.max' => 'Code must be at most 8 characters', 'departmentname.required' => 'Department name is required');
     $validator = Validator::make(Input::all(), ['departmentcode' => 'required|min:4|max:8|unique:departments,code', 'departmentname' => 'required'], $messages);
     if ($validator->fails()) {
         return redirect('adddepartment')->withInput()->withErrors($validator);
     }
     $department = new Department();
     $department->code = Input::get('departmentcode');
     $department->name = Input::get('departmentname');
     $department->total_rooms = Input::get('departmentrooms');
     $department->save();
     return view('layouts.adddepartment')->with('registermsg', 'Department added successfully');
 }
 public function postCreate()
 {
     $rules = array('name' => 'required|min:6|max:100', 'address' => 'required|min:6|max:100', 'weight_limit' => 'required', 'city_id' => 'required', 'phone' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::route('new-department')->withErrors($validator);
     }
     $department = new Department();
     $department->name = Input::get('name');
     $department->phone = Input::get('phone');
     $department->adress = Input::get('address');
     $department->city_id = intval(Input::get('city_id'));
     $department->weight_limit = intval(Input::get('weight_limit'));
     $department->save();
     return Redirect::route('departments');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     // Get request inputs
     $txtDepartmentName = $request->input('txtDepartmentName');
     $data = array('txtDepartmentName' => $txtDepartmentName);
     $rules = array('txtDepartmentName' => 'required|min:1|max:40|unique:department,name');
     // Validate input
     $reponse = Helper::validator($data, $rules, 'dashboard.settings.departments.index');
     if (isset($reponse)) {
         return $reponse;
     }
     // Create a new department
     $department = new Department();
     $department->name = $txtDepartmentName;
     $department->save();
     return redirect()->route('dashboard.settings.departments.index')->with('message', 'Department saved successfully');
 }
 public function store(DepartmentRequest $request)
 {
     $allWorker = DB::table('department_worker')->get(['user_id']);
     $duplicateWorker = [];
     $leader = $request->department_leader;
     $departmentUsers = $request->department_worker;
     array_push($departmentUsers, $request->department_leader);
     $departmentUsers = array_unique($departmentUsers);
     foreach ($allWorker as $aw) {
         if (in_array($aw->user_id, $request->department_worker)) {
             array_push($duplicateWorker, $aw->user_id);
         }
     }
     if (!empty($duplicateWorker)) {
         $users = User::whereIn('id', $duplicateWorker)->select(DB::raw('CONCAT(first_name," ",last_name) as full_name'))->get();
         $usersString = '';
         foreach ($users as $u) {
             $usersString .= $u->full_name . ',';
         }
         return response()->json(['messages' => $usersString . ' Kişileri Başka Bir Departmana Bağlıdır.'], 422);
     } else {
         foreach ($departmentUsers as $key => $value) {
             $value == $leader ? $departmentUsers[$key] = ['user_id' => $value, 'is_senior' => 1] : ($departmentUsers[$key] = ['user_id' => $value, 'is_senior' => 0]);
         }
         $this->permissionSection(function () use($request, $departmentUsers) {
             DB::transaction(function () use($request, $departmentUsers) {
                 $department = new Department();
                 $department->slug = $request->slug_name;
                 $department->name = $request->department_name;
                 $department->save();
                 $department->worker()->sync($departmentUsers);
             });
         }, 'wts.department.create');
         return response()->json($this->storeResponseMessage);
     }
 }
 public function update(DepartmentRequest $request, Department $department)
 {
     $department->name = $request->txtName;
     $department->save();
     return redirect()->route('admin.department.index')->with('success', 'Edited completely!');
 }
Beispiel #17
0
 public function run()
 {
     $unknown = new EthnicOrigin();
     $unknown->description = "No predominant or known ancestry";
     $unknown->region = "Unknown";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Kenya, Rwanda, Zimbabwe, South Sudan";
     $unknown->region = "Eastern Africa";
     $unknown->save();
     $unkown = new EthnicOrigin();
     $unknown->description = "Angola, Cameroon, Chad, Congo";
     $unknown->region = "Middle Africa";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Algeria, Tunisian, Libya, Western Sahara";
     $unknown->region = "Northern Africa";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Botswana, Namibia, Swaziland";
     $unknown->region = "Southern Africa";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Burkina Faso, Niger, Senegal";
     $unknown->region = "Western Africa";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Cuba, Haiti, Trinidad";
     $unknown->region = "Caribbean";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Mexico, Panama, Costa Rica";
     $unknown->region = "Central America";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Argentina, Brazuk, Venezuela";
     $unknown->region = "South America";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Canada, Greenland, United States of America";
     $unknown->region = "Northern America";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Kazakhstan, Tajikistan";
     $unknown->region = "Central Asia";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "China, Japan, Korea";
     $unknown->region = "Eastern Asia";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Afghanistan, India, Sri Lanka, Nepal";
     $unknown->region = "Southern Asia";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Philippines, Thailand, Indonesia, Vietnam";
     $unknown->region = "South-Eastern Asia";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Turkey, Iraq, Yemen";
     $unknown->region = "Western Asia";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Belarus, Poland, Russia";
     $unknown->region = "Eastern Europe";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "UK, Iceland, Finland, Norway";
     $unknown->region = "Northern Europe";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Italy, Greece, Spain";
     $unknown->region = "Southern Europe";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Germany, Netherlands, Belgium, France";
     $unknown->region = "Western Europe";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Australia, New Zealand";
     $unknown->region = "Australasia";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Fiji, Vanuatu, Solomon Islands";
     $unknown->region = "Melanesia";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Guam, Kiribati, Nauru";
     $unknown->region = "Micronesia";
     $unknown->save();
     $unknown = new EthnicOrigin();
     $unknown->description = "Cook Islands, Samoa, Tonga";
     $unknown->region = "Polynesia";
     $unknown->save();
     $departments[1] = 'Unknown';
     $departments[2] = 'City Administrator';
     $departments[3] = 'Community Services';
     $departments[4] = 'Corporate Services';
     $departments[5] = 'Communications and Economic Development';
     $departments[6] = 'Planning and Development';
     $departments[7] = 'Public Safety';
     $departments[8] = 'Public Works and Engineering';
     foreach ($departments as $key => $value) {
         $department = new Department();
         $department->id = $key;
         $department->active = true;
         $department->name = $value;
         $department->save();
     }
 }
Beispiel #18
0
 public function adddep(Request $request)
 {
     $newdep = new Department();
     $newdep->department_name = $request->depname;
     $newdep->hospital_id = $request->hospital;
     $newdep->department_description = $request->description;
     $newdep->classification = $request->type;
     $newdep->save();
     Session::flash('addmessage', '添加成功');
     return view('admin/department/dep');
 }
 /**
  * Initiate new department, currently with default one -- 'Main Department'
  *
  * @param $adminId
  * @return mixed
  */
 private function initiateDepartment()
 {
     $department = new Department();
     $department->name = 'main_department';
     $department->display_name = 'Main Department';
     $department->description = 'The main department of system.';
     $department->manager = 0;
     $department->save();
     // get id of main department
     return DB::table('departments')->where('name', 'main_department')->pluck('id');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Department $department)
 {
     if (!Auth::user()->can('create-department')) {
         abort(403, 'You do not have permission to update a department');
     }
     if (!$department->user_id != Auth::user()->id && !Auth::user()->can('administrate-department')) {
         //Is not the user who made it, or the site admin
         abort(401, "This user can not edit department ({$id})");
     }
     $department->secureFill(Request::all());
     if (!$department->save()) {
         abort(403, $department->errors);
     }
     return $department;
 }
 public function addDepts(Request $request)
 {
     $this->checkAdmin();
     $name = $request->collegeName;
     $entry = new Department();
     $entry->name = $name;
     $entry->save();
     return redirect('/admin/depts');
 }