當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Build::modversions方法代碼示例

本文整理匯總了PHP中Build::modversions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Build::modversions方法的具體用法?PHP Build::modversions怎麽用?PHP Build::modversions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Build的用法示例。


在下文中一共展示了Build::modversions方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: action_do_addbuild

 public function action_do_addbuild($modpack_id)
 {
     if (empty($modpack_id)) {
         return Redirect::to('modpack');
     }
     $modpack = Modpack::find($modpack_id);
     if (empty($modpack)) {
         return Redirect::to('modpack');
     }
     $rules = array("version" => "required");
     $messages = array('version_required' => "You must enter in the build number.");
     $validation = Validator::make(Input::all(), $rules, $messages);
     if ($validation->fails()) {
         return Redirect::back()->with_errors($validation->errors);
     }
     $clone = Input::get('clone');
     $build = new Build();
     $build->modpack_id = $modpack->id;
     $build->version = Input::get('version');
     $minecraft = explode(':', Input::get('minecraft'));
     $build->minecraft = $minecraft[0];
     $build->minecraft_md5 = $minecraft[1];
     $build->save();
     if (!empty($clone)) {
         $clone_build = Build::find($clone);
         $version_ids = array();
         foreach ($clone_build->modversions as $cver) {
             if (!empty($cver)) {
                 array_push($version_ids, $cver->id);
             }
         }
         $build->modversions()->sync($version_ids);
     }
     return Redirect::to('modpack/build/' . $build->id);
 }
開發者ID:pustimeunutra,項目名稱:TechnicSolder,代碼行數:35,代碼來源:modpack.php

示例2: postAddBuild

 public function postAddBuild($modpack_id)
 {
     $modpack = Modpack::find($modpack_id);
     if (empty($modpack)) {
         return Redirect::to('modpack/list')->withErrors(new MessageBag(array('Modpack not found')));
     }
     $rules = array("version" => "required", "memory" => "numeric");
     $messages = array('version.required' => "You must enter in the build number.", 'memory.numeric' => "You may enter in numbers only for the memory requirement");
     $validation = Validator::make(Input::all(), $rules, $messages);
     if ($validation->fails()) {
         return Redirect::back()->withErrors($validation->messages());
     }
     $clone = Input::get('clone');
     $build = new Build();
     $build->modpack_id = $modpack->id;
     $build->version = Input::get('version');
     $minecraft = Input::get('minecraft');
     $build->minecraft = $minecraft;
     $build->min_java = Input::get('java-version');
     $build->min_memory = Input::get('memory-enabled') ? Input::get('memory') : 0;
     $build->save();
     Cache::forget('modpack.' . $modpack->slug);
     if (!empty($clone)) {
         $clone_build = Build::find($clone);
         $version_ids = array();
         foreach ($clone_build->modversions as $cver) {
             if (!empty($cver)) {
                 array_push($version_ids, $cver->id);
             }
         }
         $build->modversions()->sync($version_ids);
     }
     return Redirect::to('modpack/build/' . $build->id);
 }
開發者ID:GoatEli,項目名稱:TechnicSolder,代碼行數:34,代碼來源:ModpackController.php


注:本文中的Build::modversions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。