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


PHP Part::find方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($story)
 {
     $input = $request->all();
     $story_id = $story;
     $chapter = new chapter();
     $part->story_id = $story_id;
     $part->title = $input['title'];
     $part->description = $input['description'];
     //place of part
     $position = 0;
     $current_position = Part::where('story_id', $story)->pluck('position');
     if (empty($current_positioncount)) {
         $current_position = 0;
     } else {
         $current_position;
     }
     //current_position = 1
     if ($position <= $current_position) {
         $position = $current_position + 1;
         //expect position to go to 2
     } else {
         $position = $current_position;
     }
     $part->position = $position;
     //setting position 2
     $part->save();
     //image
     $destinatonPath = '';
     $filename = '';
     $file = Input::file('image');
     $destinationPath = public_path() . '/images/parts';
     $filename = $part->id . '_' . $file->getClientOriginalName();
     $uploadSuccess = $file->move($destinationPath, $filename);
     $addimage = Part::find($part->id);
     $addimage->image = $filename;
     $addimage->save();
     return redirect('story/' . $story . '/edit');
 }
开发者ID:hannesverdoodt,项目名称:urbantell,代码行数:43,代码来源:ChapterController.php

示例2: getpart

 private function getpart($type)
 {
     $items = Part::find(array("type=:type:", "bind" => array("type" => $type)));
     $parts = array();
     foreach ($items as $index => $item) {
         $parts[$index] = $item;
     }
     return $parts;
 }
开发者ID:sify21,项目名称:Question,代码行数:9,代码来源:IndexController.php

示例3: get_undo_parts

 function get_undo_parts()
 {
     $results = array();
     $count_sum = 0;
     /* 生产数量合计 */
     $feeding_price_sum = 0;
     /* 投料金额合计 */
     $parts = Part::find('all', array('conditions' => array('is_done = ?', 0), 'order' => 'id asc'));
     //
     foreach ($parts as $part) {
         $results['parts'][] = array('part_num' => $part->num, 'part_name' => $part->name, 'part_count' => $part->count, 'part_feeding_price' => $part->feeding_price, 'prod_type' => get_prod_type($part->production->type), 'prod_graphic_src' => get_prod_graphic_src($part->production->graphic_src));
         $count_sum += $part->count;
         $feeding_price_sum += $part->feeding_price;
     }
     $results['count_sum'] = $count_sum;
     $results['feeding_price_sum'] = $feeding_price_sum;
     return $results;
 }
开发者ID:saintyk,项目名称:yndl_2,代码行数:18,代码来源:Part.php

示例4: addTest

 public function addTest($school)
 {
     $test = new Test();
     $test->people = 2;
     $test->school_id = $school->school_id;
     $test->begin_time = '2014-12-5 00:00:00';
     $test->end_time = '2014-12-15 23:59:59';
     $parts = Part::find();
     $test->exam_num = $parts->Count();
     $test->description = '2014心理健康测评';
     if (!$test->save()) {
         foreach ($school->getMessages() as $message) {
             throw new PDOException($message);
         }
     }
     foreach ($parts as $part) {
         $tprel = new Tprel();
         $tprel->test_id = $test->t_id;
         $tprel->part_id = $part->p_id;
         $tprel->save();
     }
     return $test;
 }
开发者ID:sify21,项目名称:Question,代码行数:23,代码来源:ImportController.php


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