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


PHP Institution::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created institution in storage.
  *
  * @return Response
  */
 public function store()
 {
     //$alldata = Input::all();/*   this gets all*/
     $data = Input::only('title', 'body', 'topcolor', 'topfontcolor', 'currentdi', 'extracomments');
     $data['logo'] = json_encode(Input::get('fileid'));
     // validation rules
     $rules = array('title' => 'required', 'logo' => 'required');
     $validator = Validator::make($data, $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     // @todo: I need to move the file out of tmp to someplace else.
     Institution::create($data);
     // @todo: route to the "show" of the institution
     return Redirect::route('institutions.index');
 }
开发者ID:EthanK28,项目名称:laravel-with-jquery-upload,代码行数:21,代码来源:InstitutionsController.php

示例2: postNewCollege

 public function postNewCollege()
 {
     //verify the user input and create account
     $validator = Validator::make(Input::all(), array('Country' => 'required|exists:countrys,id', 'College_Name' => 'required|max:200|unique:institutions,name', 'Alias' => 'required|max:50', 'Pic' => 'image|max:3000'));
     if ($validator->fails()) {
         return Redirect::route('newcollege-get')->withErrors($validator)->withInput()->with('global', 'Sorry!! College details were not posted, please retry.');
     } else {
         $countryid = Input::get('Country');
         $collegename = Input::get('College_Name');
         $alias = Input::get('Alias');
         $file = Input::file('Pic');
         $photo = null;
         $user_id = Auth::user()->id;
         if ($file != null) {
             //photos validation
             $destinationPath = 'logos';
             $ext = $file->guessClientExtension();
             // Get real extension according to mime type
             $fullname = $file->getClientOriginalName();
             // Client file name, including the extension of the client
             $hashname = date('H.i.s') . '-' . md5($fullname) . '.' . $ext;
             // Hash processed file name, including the real extension
             $upload_success = $file->move($destinationPath, $hashname);
             //Set the photo path name to hashname
             $photo = $hashname;
         }
         //save college to the database
         $institution = Institution::create(array('user_id' => $user_id, 'country_id' => $countryid, 'name' => $collegename, 'alias' => $alias, 'photo' => $photo));
         if ($institution) {
             View::share('selectedcountryid', $institution->country_id);
             $countries = Country::where('id', '>', 0)->get();
             View::share('countries', $countries);
             $colleges = Institution::where('id', '>', 0)->get();
             View::share('colleges', $colleges);
             View::share('selectedcollegeid', $institution->id);
             return View::make('member.addmaincampus')->with('global', 'Success!! College Details saved. Enter Main Campus Details');
         }
         return Redirect::route('newcollege-get')->withInput()->with('global', 'Sorry!! College details were not posted, please retry.');
     }
 }
开发者ID:franqq,项目名称:squeeber,代码行数:40,代码来源:CollegeController.php


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