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


PHP Language::save方法代码示例

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


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

示例1: update

 /**
  * Update the specified language in storage.
  *
  * @param Language $language
  * @param LanguageRequest $request
  * @return Response
  */
 public function update(Language $language, LanguageRequest $request)
 {
     $data = $this->storeImage($request, 'flag');
     $language->fill($data);
     $language->save() == true ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
     return redirect(route('admin.language.index'));
 }
开发者ID:abada,项目名称:laravel-5-simple-cms,代码行数:14,代码来源:LanguageController.php

示例2: index

 public function index()
 {
     if (Request::isMethod('get')) {
         $lang = Language::orderBy('id', 'desc')->get();
         return view('admin.language.list', array('langs' => $lang));
     }
     /*
     	When create a language. System will scan in English folder (default language)
     	to get all files avaliable to translate. Then create all new file with same name
     	in English folder
     */
     $data = Request::all();
     $main_folder = base_path() . '/resources/lang/';
     $exist_folder = file_exists($main_folder . $data['code']);
     if ($exist_folder) {
         return 'exist_folder';
     } else {
         mkdir($main_folder . $data['code']);
         // get all file in English and make a new copy same name in new language
         /*$list_files = array_diff(scandir($main_folder.'en'),array('..', '.'));
         		foreach($list_files as $file){ 
         		    fopen($main_folder.$data['code'].'/'.$file, "w");
         		}
         		*/
     }
     $l = new Language();
     $l->name = $data['name'];
     $l->code = $data['code'];
     $l->save();
 }
开发者ID:namcoder,项目名称:Topshare,代码行数:30,代码来源:LanguageController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(LanguageRequest $request)
 {
     $language = new Language($request->all());
     $language->user_id = Auth::id();
     $language->save();
     Logs::_create('User create language ' . $language->name);
 }
开发者ID:RMMusic,项目名称:CSE,代码行数:12,代码来源:LanguageController.php

示例4: postAdd

 public function postAdd(Request $request)
 {
     if (!ACL::hasPermission('languages', 'add')) {
         return redirect(route('languages'))->withErrors(['You don\'t have permission for add new language.']);
     }
     $this->validate($request, ['languageName' => 'required|max:45', 'flag' => 'required|image|mimes:jpeg,bmp,gif,png', 'write' => 'required', 'read' => 'required', 'speak' => 'required', 'listen' => 'required']);
     $lastLanguage = Language::orderBy('sortorder', 'DESC')->addSelect('sortorder')->first();
     $sortorder = isset($lastLanguage) ? $lastLanguage->sortorder + 1 : 1;
     $language = new Language();
     $language->languageName = $request->languageName;
     //FLAG
     $extension = $request->flag->getClientOriginalExtension();
     $nameFlag = Carbon::now()->format('YmdHis') . "." . $extension;
     $img = Image::make($request->file('flag'));
     $img->resize($this->flagWidth, $this->flagHeight)->save($this->folder . $nameFlag);
     $language->flag = $nameFlag;
     $language->write = $request->write;
     $language->read = $request->read;
     $language->speak = $request->speak;
     $language->listen = $request->listen;
     $language->sortorder = $sortorder;
     $language->save();
     $success = "Language added successfully.";
     return redirect(route('languages'))->with(compact('success'));
 }
开发者ID:brunomartins-com,项目名称:Personal-Website-with-Laravel,代码行数:25,代码来源:LanguageController.php

示例5: run

 public function run()
 {
     DB::table('languages')->delete();
     $language = new Language();
     $language->name = 'English';
     $language->lang_code = 'gb';
     $language->save();
 }
开发者ID:RMMusic,项目名称:CSE,代码行数:8,代码来源:LanguageTableSeeder.php

示例6: 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, ['language' => 'required|unique:languages']);
     $language = new Language();
     $language->language = $request->language;
     $language->save();
     $statusCode = 200;
     $response = ["success" => "Language {$request->language} successfully created"];
     return response($response, $statusCode);
 }
开发者ID:mudragel,项目名称:matematika-test.loc,代码行数:17,代码来源:LanguageController.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $language = new Language();
     $language->name = $request->name;
     if (!$language->save()) {
         // redirect back to create and show errors
         return redirect()->route('admin.languages.create')->with('errors', $language->getErrors())->withInput();
     }
     // success!
     // redirect to index, with success message
     return redirect()->route('admin.languages.index')->with('message', '<div class="alert alert-success">Your new language was created!</div>');
 }
开发者ID:alexpcoleman,项目名称:fitl,代码行数:18,代码来源:LanguageController.php

示例8: guardarDatos

 public function guardarDatos($request, $id)
 {
     $data = $request->all();
     $rules = ['name' => 'required'];
     $this->validate($request, $rules);
     if ($id != null) {
         $language = Language::findOrFail($id);
     } else {
         $language = new Language();
     }
     $language->name = $request->input('name');
     $language->save();
 }
开发者ID:serranozafra,项目名称:pruebaHectorSerrano,代码行数:13,代码来源:LanguageController.php

示例9: run

 public function run()
 {
     DB::table('languages')->delete();
     $language = new Language();
     $language->name = 'English';
     $language->lang_code = 'gb';
     $language->save();
     $language = new Language();
     $language->name = 'Српски';
     $language->lang_code = 'rs';
     $language->save();
     $language = new Language();
     $language->name = 'Bosanski';
     $language->lang_code = 'ba';
     $language->save();
 }
开发者ID:zcosmin20,项目名称:Laravel-5-Bootstrap-3-Starter-Site,代码行数:16,代码来源:LanguageTableSeeder.php

示例10: run

 public function run()
 {
     DB::table('language')->delete();
     $language = new Language();
     $language->name = 'English';
     $language->lang_code = 'en';
     $language->icon = "icon_flag_gb.gif";
     $language->save();
     $language = new Language();
     $language->name = 'Српски';
     $language->lang_code = 'sr';
     $language->icon = "icon_flag_sr.gif";
     $language->save();
     $language = new Language();
     $language->name = 'Bosanski';
     $language->lang_code = 'bs';
     $language->icon = "icon_flag_bs.gif";
     $language->save();
 }
开发者ID:ryleto,项目名称:nightjar,代码行数:19,代码来源:LanguagesTableSeeder.php

示例11: postCreate

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCreate(LanguageRequest $request)
 {
     $language = new Language();
     $language->user_id = Auth::id();
     $language->lang_code = $request->lang_code;
     $language->name = $request->name;
     $icon = "";
     if (Input::hasFile('icon')) {
         $file = Input::file('icon');
         $filename = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $icon = sha1($filename . time()) . '.' . $extension;
     }
     $language->icon = $icon;
     $language->save();
     if (Input::hasFile('icon')) {
         $destinationPath = public_path() . '/images/language/' . $language->id . '/';
         Input::file('icon')->move($destinationPath, $icon);
     }
 }
开发者ID:Rotron,项目名称:laravel5-shop,代码行数:25,代码来源:LanguageController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(LanguageRequest $request)
 {
     $language = new Language($request->all());
     $language->user_id = Auth::id();
     $language->save();
 }
开发者ID:TDMU,项目名称:CSE,代码行数:11,代码来源:LanguageController.php

示例13: update

 /**
  * Update the specified language in storage.
  *
  * @param Language $language
  * @param LanguageRequest $request
  * @return Response
  */
 public function update(Language $language, LanguageRequest $request)
 {
     $language->fill(ImageService::uploadImage($request, 'flag'));
     $language->save() ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
     return redirect(route('admin.language.index'));
 }
开发者ID:kravn,项目名称:TTG-CMS,代码行数:13,代码来源:LanguageController.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $input = $request->input();
     if ($input['level'] == 1) {
         /*$photo = array('resume_photo' => Input::file('resume_photo'),'passport' =>Input::file('passport'));
         			$rules = array('resume_photo' => 'required');//mimes:jpeg,bmp,png|max:10000','passport' => 'required|mimes:jpeg,png,pdf,doc|max:10000'); //mimes:jpeg,bmp,png and for max size max:10000
           // doing the validation, passing post data, rules and the messages
         $validator = Validator::make($photo, $rules);
         if ($validator->fails()) {
             // send back to the page with the input data and errors
         	return Redirect::to('resume.create')->withInput()->withErrors($validator);
         }
         else {*/
         if (Input::file('resume_photo')) {
             $resume_photo = array('file' => Input::file('resume_photo'), 'extention' => Input::file('resume_photo')->getClientOriginalExtension());
             $rules = array('file' => 'required|max:2048', 'extention' => 'required|In:jpeg,bmp,png');
             $validator = Validator::make($resume_photo, $rules);
             if ($validator->fails()) {
                 // send back to the page with the input data and errors
                 // $validator->errors()->add('resume_photo', 'Invalide File');
                 Session::flash('message', 'File must be less than 2Mb and only jpeg,bmp,png');
                 return view('resume.create')->withErrors($validator)->with('id', $input['resumeId'])->with('state', $input['level']);
             } else {
                 $destinationPath = 'upload';
                 $photoExtension = Input::file('resume_photo')->getClientOriginalExtension();
                 $photoName = rand(11111, 99999) . '_photo' . '.' . $photoExtension;
                 Input::file('resume_photo')->move($destinationPath, $photoName);
             }
         }
         if (Input::file('passport')) {
             $passport = array('file' => Input::file('passport'), 'extention' => Input::file('passport')->getClientOriginalExtension());
             $rules = array('file' => 'required|max:2048', 'extention' => 'required|In:jpeg,bmp,png,pdf,doc,docx');
             $validator = Validator::make($passport, $rules);
             if ($validator->fails()) {
                 // send back to the page with the input data and errors
                 // $validator->errors()->add('passport', 'File size must be less than 2MB and only .jpeg,.bmp,.png');
                 Session::flash('message', 'File must be less than 2Mb and only jpeg,bmp,png,pdf,doc,docx');
                 return view('resume.create')->withErrors($validator)->with('id', $input['resumeId'])->with('state', $input['level']);
             } else {
                 $destinationPath = 'upload';
                 $passportExtension = Input::file('passport')->getClientOriginalExtension();
                 $passportName = rand(11111, 99999) . '_passport' . '.' . $passportExtension;
                 Input::file('passport')->move($destinationPath, $passportName);
             }
         }
         $ret = PersonalInformation::where('id', $input['resumeId'])->first();
         if ($ret) {
             $resume = PersonalInformation::find($input['resumeId']);
             $resume->fname = $input['fname'];
             $resume->lname = $input['lname'];
             $resume->resume_photo = isset($photoName) ? $photoName : $ret->resume_photo;
             $resume->passport = isset($passportName) ? $passportName : $ret->passport;
             $resume->dob = $input['dob'];
             $resume->age = $input['age'];
             $resume->gender = $input['gender'];
             $resume->height = $input['height'];
             $resume->email = $input['email'];
             $resume->nationality = $input['nationality'];
             $resume->mobile = $input['mobile'];
             $resume->onumber = isset($input['onumber']) ? $input['onumber'] : '';
             $resume->raddress1 = $input['raddress1'];
             $resume->raddress2 = $input['raddress2'];
             $resume->city = isset($input['city']) ? $input['city'] : '';
             $resume->postal_code = $input['postal_code'];
             $resume->country = $input['country'];
             $resume->state = $input['state'];
             $resume->identification = $input['identification'];
             $resume->inumber = $input['inumber'];
             $resume->save();
             $rethistory = History::whereAction_idAndAction($resume->id, 'Resume Updated')->first();
             if ($rethistory) {
                 $history = History::find($rethistory->id);
                 $history->action = 'Resume Updated';
                 $history->user = Auth::user()->name;
                 $history->remark = '';
                 $history->save();
             } else {
                 $history = new History();
                 $history->action_id = $resume->id;
                 $history->action = 'Resume Updated';
                 $history->user = Auth::user()->name;
                 $history->remark = '';
                 $history->save();
             }
         } else {
             $resume = new PersonalInformation();
             $resume->agent_id = Auth::user()->id;
             $resume->approval_status = 0;
             $resume->approved_by = 0;
             $resume->agent_approval_delete = 0;
             $resume->fname = $input['fname'];
             $resume->lname = $input['lname'];
             $resume->resume_photo = isset($photoName) ? $photoName : '';
             $resume->passport = isset($passportName) ? $passportName : '';
             $resume->dob = $input['dob'];
//.........这里部分代码省略.........
开发者ID:bimnaresh,项目名称:recruitment_history,代码行数:101,代码来源:ResumeController.php

示例15: addLanguage

 /**
  * Add a language to the users profile.
  */
 public function addLanguage(Request $request)
 {
     $profile = Profile::where('user_id', '=', \Auth::id())->select('id')->first();
     $v = \Validator::make($request->all(), ['name' => 'required|min:3', 'level' => 'required|in:basic,intermediate,advanced']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors());
     }
     $lang = new Language($request->all());
     $lang->profile_id = $profile->id;
     $lang->save();
     return redirect()->route('profile.edit');
 }
开发者ID:charlieboo,项目名称:creatrip,代码行数:15,代码来源:ProfileController.php


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