当前位置: 首页>>代码示例>>PHP>>正文


PHP Department::save方法代码示例

本文整理汇总了PHP中app\Department::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::save方法的具体用法?PHP Department::save怎么用?PHP Department::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Department的用法示例。


在下文中一共展示了Department::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * 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');
 }
开发者ID:suxiid,项目名称:application,代码行数:14,代码来源:DepartmentsController.php

示例2: store

 /**
  * 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');
 }
开发者ID:polodev,项目名称:distanceLearning,代码行数:14,代码来源:DepartmentController.php

示例3: store

 /**
  * 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!');
 }
开发者ID:mycrazydog,项目名称:mm-shibboleth,代码行数:14,代码来源:DepartmentsController.php

示例4: store

 /**
  * 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');
 }
开发者ID:amolkattel,项目名称:Asset-Mgnt-Project,代码行数:15,代码来源:DepartmentsController.php

示例5: store

 /**
  * 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!');
 }
开发者ID:dinhtich1991,项目名称:staff,代码行数:15,代码来源:DepartmentController.php

示例6: run

 /**
  * 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();
     }
 }
开发者ID:vitz3,项目名称:IserveU,代码行数:15,代码来源:DepartmentTableSeeder.php

示例7: run

 /**
  * 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();
 }
开发者ID:bpatplus,项目名称:dbproject,代码行数:15,代码来源:DepartmentsTableSeeder.php

示例8: store

 /**
  * 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();
 }
开发者ID:elieishimwe,项目名称:Siyaleader-Transnet,代码行数:16,代码来源:DepartmentController.php

示例9: store

 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');
 }
开发者ID:MangTomas23,项目名称:cnhs-portal,代码行数:11,代码来源:DepartmentController.php

示例10: store

 /**
  * 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();
 }
开发者ID:mcoyevans,项目名称:personiv-productivity-quality-report,代码行数:17,代码来源:DepartmentController.php

示例11: store

 /**
  * 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();
 }
开发者ID:elieishimwe,项目名称:Siyaleader-DUT,代码行数:18,代码来源:DepartmentController.php

示例12: registerdepartment

 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');
 }
开发者ID:nikeshakya,项目名称:KU-SMS,代码行数:14,代码来源:DepartmentController.php

示例13: postCreate

 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');
 }
开发者ID:yaroslavmelnichuk,项目名称:LarkaKursova,代码行数:16,代码来源:DepartmentsController.php

示例14: store

 /**
  * 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');
 }
开发者ID:AdaptiveAds,项目名称:AdaptiveAds,代码行数:23,代码来源:DepartmentController.php

示例15: store

 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);
     }
 }
开发者ID:pinnaclesoftware,项目名称:Work-Tracking-System,代码行数:36,代码来源:DepartmentController.php


注:本文中的app\Department::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。