本文整理汇总了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');
}
示例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;
}
示例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;
}
示例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;
}