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


PHP Department::create方法代码示例

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


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

示例1: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     // Create level 0 : member
     Level::create(['level' => 0, 'name' => 'membre']);
     // Create level 1 : band_creator
     Level::create(['level' => 1, 'name' => 'manager']);
     // Create level 2 : teacher
     Level::create(['level' => 2, 'name' => 'professeur']);
     // Create level 3 : admin
     Level::create(['level' => 3, 'name' => 'admin']);
     // Create level 10 : webmaster
     Level::create(['level' => 10, 'name' => 'webmaster']);
     // Create departement : "aucun"
     Department::create(['name' => 'Aucun', 'short_name' => 'Aucun']);
     // Create user : Webmaster (lvl 10)
     User::create(['first_name' => 'Webmaster', 'last_name' => 'Webmaster', 'email' => 'webm@ster', 'school_year' => 0, 'department_id' => 1, 'password' => bcrypt('webmastercmt'), 'level_id' => 5, 'slug' => 'webmaster-webmaster-1']);
     Category::create(['name' => 'Aucune']);
     Category::create(['name' => 'Autre']);
     Category::create(['name' => 'Présentation']);
     Category::create(['name' => 'Création de groupe']);
     Category::create(['name' => 'Recherche de groupe']);
     Category::create(['name' => 'Échange/Vente']);
     //Creation basic instruments :
     $instruments = ['autre', 'guitare', 'piano', 'basse', 'chant', 'flûte', 'violon', 'contrebasse', 'clarinette', 'saxophone', 'batterie', 'violoncelle', 'guitare électrique', 'flûte traversière', 'trompette', 'cor', 'trombone', 'tuba'];
     $this->create_instrument($instruments);
 }
开发者ID:Techraav,项目名称:PolyMusic,代码行数:31,代码来源:2017_03_04_153520_create_base_entries.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $data = $request->except('_token');
     Department::create($data);
     return back();
 }
开发者ID:sunhuang2015,项目名称:feotask,代码行数:13,代码来源:DepartmentController.php

示例3: importDept

 public function importDept($destfile)
 {
     $this->count['dept->success'] = 0;
     $this->count['dept->failed'] = 0;
     Excel::load($destfile, function ($reader) {
         $rules = ['name' => 'required|unique_with:departments,company_id,costcent', 'company_id' => 'required|exists:companies,id', 'costcent' => 'required'];
         $sheetsCount = $reader->getSheetCount();
         for ($i = 0; $i < $sheetsCount; $i++) {
             $sheets = $reader->getSheet($i)->toArray();
             $company_name = $reader->getSheet($i)->getTitle();
             $dept['company_id'] = Company::where('name', $company_name)->value('id');
             $sheetCount = count($sheets);
             for ($j = 6; $j < $sheetCount; $j++) {
                 $dept['name'] = trim($sheets[$j][1]);
                 $dept['costcent'] = trim($sheets[$j][10]);
                 $dept['description'] = $dept['name'];
                 $dept_v = \Validator::make($dept, $rules);
                 if ($dept_v->passes()) {
                     Department::create($dept);
                     $this->count['dept->success'] += 1;
                 } else {
                     $this->count['dept->failed'] += 1;
                 }
             }
         }
         //END
     });
     return $this->count;
 }
开发者ID:sunhuang2015,项目名称:feotask,代码行数:29,代码来源:UploadController.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 10) as $index) {
         Department::create(['title' => $faker->company]);
     }
 }
开发者ID:BinaryStudioAcademy,项目名称:reviewr,代码行数:12,代码来源:DepartmentTableSeeder.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('departments')->delete();
     Department::create(['title' => 'Администрация']);
     Department::create(['title' => 'Отдел 1']);
     Department::create(['title' => 'Отдел 2']);
     Department::create(['title' => 'Отдел 3']);
 }
开发者ID:Colls,项目名称:mobilsoft.task,代码行数:13,代码来源:DepartmentsSeeder.php

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('Departments')->delete();
     $departments = array(['department_name' => 'department of electrical and power engineering', 'faculty_id' => '1'], ['department_name' => 'department of electrical and telcom engineering', 'faculty_id' => '1'], ['department_name' => 'department of computer science', 'faculty_id' => '2']);
     foreach ($departments as $department) {
         Department::create($department);
     }
 }
开发者ID:ducaale,项目名称:university-management-app,代码行数:14,代码来源:departmentTableSeeder.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(DepartmentRequest $request)
 {
     try {
         Department::create($request->all());
         Flash::success('The Department has been created.');
         return redirect()->route('department.index');
     } catch (Exception $e) {
         Flash::error('The Department could not be created.');
     }
 }
开发者ID:omoprodigi,项目名称:Keyword-Matching-Exam,代码行数:16,代码来源:DepartmentController.php

示例8: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     if (Request::isMethod('get')) {
         $this->data['items'] = Department::get();
         return view('pages.department.create', $this->data);
     } elseif (Request::isMethod('post')) {
         $department = Department::create(Input::all());
         return redirect('department');
     }
 }
开发者ID:bilfash,项目名称:monstaff,代码行数:15,代码来源:DepartmentController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     if ($this->validator($request->all())->fails()) {
         flash()->error('There is something wrong with the inputs.');
         return redirect()->back();
     } else {
         Department::create($request->all());
         flash()->success("Department successfully added!");
         return redirect()->back();
     }
 }
开发者ID:rosemalejohn,项目名称:hpo-hris,代码行数:17,代码来源:DepartmentController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         Flash::error('Impossible d\'ajouter ce département.');
         return Redirect::back()->withErrors($validator->errors());
     }
     $dep = Department::create(['name' => $request->name, 'short_name' => $request->short_name]);
     Modification::create(['table' => 'departments', 'user_id' => Auth::user()->id, 'message' => 'added department ' . $request->name . ' (' . $request->short_name . ')']);
     Flash::success('Le département a bien été créé !');
     return redirect('admin/departments');
 }
开发者ID:Techraav,项目名称:PolyMusic,代码行数:17,代码来源:DepartmentController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \App\Http\Requests\DepartmentRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\DepartmentRequest $request)
 {
     DB::transaction(function () use($request) {
         $department = Department::create(['keyword' => $request->get('keyword'), 'url' => $request->get('url'), 'image' => $request->file('image')->getClientOriginalName(), 'theme_background_color' => $request->get('theme_background_color'), 'theme_color' => $request->get('theme_color'), 'sort' => $request->get('sort'), 'active' => $request->get('active')]);
         $this->addDepartmentLangs($request, $department);
         $request->file('image')->move('images/', $request->file('image')->getClientOriginalName());
         if (!File::exists('papers/' . $department->keyword)) {
             File::makeDirectory('papers/' . $department->keyword);
         }
         Cache::forget('departments');
     });
     return redirect(action('Admin\\DepartmentController@index'))->with('success', 'saved');
 }
开发者ID:Tisho84,项目名称:conference,代码行数:19,代码来源:DepartmentController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     Department::create($request->input());
     foreach (BusinessPlan::lists('id') as $bid) {
         $newGoal = new Goat();
         $newGoal->type = 'G';
         $newGoal->parent_id = null;
         $newGoal->description = $request['name'] . " Goals";
         $newGoal->priority = 0;
         $newGoal->complete = false;
         $newGoal->goal_type = 'D';
         $newGoal->due_date = null;
         $newGoal->budget = 0;
         $newGoal->bid = $bid;
         $newGoal->save();
     }
     return redirect('admin/depts');
 }
开发者ID:macewanCS,项目名称:DreamSolutions,代码行数:24,代码来源:DepartmentController.php

示例13: addDepartment

 /**
  * Add a department
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function addDepartment(Request $request)
 {
     $dCode = $request['dCode'];
     $dName = $request['dName'];
     Department::create(['dCode' => $dCode, 'dName' => $dName]);
     return redirect()->back()->with('status', 'Success');
 }
开发者ID:prateekprshr-nith,项目名称:beautifulCode,代码行数:13,代码来源:HomeController.php

示例14: store

 public function store(DepartmentRequest $request, Department $department)
 {
     $department->create($request->all());
     return redirect('/configuration#department')->withSuccess(config('constants.ADDED'));
 }
开发者ID:EneaWeb,项目名称:aliangel,代码行数:5,代码来源:DepartmentController.php

示例15: store

 /**
  * Store a newly created department in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(SaveDepartmentRequest $request)
 {
     Department::create(['code' => $request->code, 'name' => $request->name]);
     $departments = Department::all();
     return view('layouts.viewDepartments', ['departments' => $departments]);
 }
开发者ID:arnabrahman,项目名称:Course-and-Result-Management,代码行数:12,代码来源:DepartmentController.php


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