/**
  * Store a newly created resource in storage.
  *
  * @param  Requests\DepartmentsValidator|Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\DepartmentsValidator $request)
 {
     $departments = new Departments();
     $departments->department_name = $request->get('department_name');
     $departments->department_manager = $request->get('department_manager');
     $departments->department_description = $request->get('department_description');
     $departments->save();
     $department_id = $departments->id;
     $manager = new DepartmentMembers();
     $manager->departmentid = $department_id;
     $manager->userid = $request->get('department_manager');
     $manager->save();
     \Session::flash('message', "New department has been saved");
     return redirect('staff/departments');
 }
Exemplo n.º 2
0
 public function addPost()
 {
     $arrDept = array();
     $arrType = array('Text', 'Image', 'Audio', 'Video');
     $post = array('title' => '');
     $arrDept = Departments::lists('name', 'id');
     return view('pages.addPost', array('arrDept' => $arrDept, 'arrType' => $arrType, 'post' => $post, 'arrDept' => $arrDept));
 }
Exemplo n.º 3
0
 public function getEditUser($id, Request $request)
 {
     $request->session()->forget('user_id');
     $user = User::find($id);
     $departments = Departments::select()->get();
     $statuses = DB::table('user_status')->select()->get();
     $request->session()->push('user_id', $id);
     return view('user.edit', array('user' => $user, 'departments' => $departments, 'statuses' => $statuses));
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $departments = Departments::lists('department_name', 'id');
     return view('Course.create', compact('schools', 'departments'));
 }
Exemplo n.º 5
0
 /**
  * Show the form for creating a new team.
  */
 public function create()
 {
     $data["departments"] = Departments::all();
     $data["users"] = User::all();
     return view('teams/create', $data);
 }
Exemplo n.º 6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param $id
  *
  * @return
  */
 public function edit($id)
 {
     $data['user'] = User::findOrFail($id);
     $data['departments'] = Departments::all();
     $data['teams'] = Teams::all();
     $data['countries'] = Countries::all();
     $data['roles'] = Role::all();
     return view('staff/edit_user', $data);
 }
Exemplo n.º 7
0
 public function edit($id)
 {
     $employee = Employees::findOrFail($id);
     $departments = Departments::lists('department_name', 'id');
     return view('pages.editEmployee', compact('employee', 'departments'));
 }
Exemplo n.º 8
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function homeOld()
 {
     $departments = Departments::all();
     return view('home')->with('departments', $departments);
 }
 public function deleteDepartment(Request $request)
 {
     $result = Departments::where('id', $request->input('department'))->update(array('status' => 1));
     if ($result) {
         $status = "Success!";
     } else {
         $status = "Failed!";
     }
     return redirect('/accounts')->with('status', $status);
 }
Exemplo n.º 10
0
 public function getTasks()
 {
     $department_id = $_GET['department_id'];
     $tasks = json_encode(Departments::find($department_id)->tasks);
     return $tasks;
 }
 public function store()
 {
     $input = Request::all();
     Departments::create($input);
     return redirect('dept');
 }
Exemplo n.º 12
0
 public function getReg()
 {
     $departments = Departments::select()->get();
     return view('account.userreg', array('departments' => $departments));
 }
 public function assign()
 {
     $users = User::lists('name', 'id');
     $schools = Schools::lists('school_name', 'id');
     $departments = Departments::lists('department_name', 'id');
     $designations = Designations::lists('designation', 'id');
     return view('Designation.assign', compact('schools', 'departments', 'designations', 'users'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(DepartmentRequest $request)
 {
     Departments::create(['schools_id' => $request->input('schools_id'), 'department_name' => $request->input('department_name')]);
     return redirect(action('DepartmentController@index'));
 }