當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。