本文整理汇总了PHP中Card::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Card::find方法的具体用法?PHP Card::find怎么用?PHP Card::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card::find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$card = Card::find($id);
$card->fill(Input::all());
$card->save();
return Response::json(array('success' => true));
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$card = Card::find($id);
return $card;
}
示例3: view
public function view($id)
{
//$this->output->enable_profiler(true);
$id = (int) $id;
$this->load->model('Card');
$data['id'] = $id;
$card = Card::find($id);
$card->with_version_when_deleted()->with_card_contents_history();
foreach ($card->get_card_contents_history() as $card_content) {
$card_content->with_version();
}
$data['card'] = $card;
$finder_manager = new Finder_manager('Deck', 'find_with_contains_current_card', FIND_MANY, ['id_card' => $id]);
$decks = $finder_manager->get();
$data['decks'] = $decks;
$this->layout->add_basic_assets()->menu()->action_view($data);
}
示例4: addAction
public function addAction()
{
//var_dump(Input::all());
if (Input::server("REQUEST_METHOD") == "POST") {
try {
$action = "insert";
$id = Input::get('id');
//$school = Input::get('school');
$course = Input::get('course');
$name = Input::get('name');
$description = Input::get('description');
$fluency = Input::get('fluency');
$publish = Input::get('publish');
$cards_id = Input::get('card_ids');
$f_text = Input::get('f_text');
$f_cardtype = Input::get('cardtype');
$f_text_option = Input::get('f_text_option');
$f_sound = Input::get('f_sound');
$f_image = Input::get('f_image');
if (isset($id) && !empty($id)) {
$sprint = Sprint::find($id);
$action = "update";
$cards = DB::table('cards')->where('sprint', $id)->get();
foreach ($cards as $card) {
$flag = false;
for ($i = 0; $i < sizeof($cards_id); $i++) {
if ($card->id == $cards_id[$i]) {
$flag = true;
}
}
if (!$flag) {
DB::table('cards')->where('id', $card->id)->delete();
}
}
} else {
$sprint = new Sprint();
}
//$sprint->school = $school;
$sprint->course = $course;
$sprint->name = $name;
$sprint->description = $description;
$sprint->fluency_rate = $fluency;
$sprint->published = $publish;
$sprint->save();
if ($action == "insert") {
$sprint_id = DB::getPdo()->lastInsertId();
} else {
$sprint_id = $id;
}
$cards = "";
for ($i = 0; $i < count($f_text); $i++) {
$idx = $i + 1;
$card_type = $f_cardtype[$i];
$cardid = $cards_id[$i];
if ($action == "update" && $cardid > 0) {
$card = Card::find($cardid);
} else {
$card = new Card();
}
$card->sprint = $sprint_id;
$card->card_type = $card_type;
$card->f_text = $f_text[$i];
if (!empty($f_text_option[$i])) {
$card->f_text_option = $f_text_option[$i];
} else {
$card->f_text_option = 0;
}
if (!empty($f_sound[$i])) {
$f_sound_path = "";
$f_sound_file = "";
if ($f_sound[$i] == "none") {
$card->f_sound_option = 0;
} else {
$card->f_sound_option = 1;
$f_sound_pos = strripos($f_sound[$i], "/");
$f_sound_path = substr($f_sound[$i], 0, $f_sound_pos + 1);
$f_sound_file = substr($f_sound[$i], $f_sound_pos + 1);
}
$card->f_sound = $f_sound_file;
$card->f_sound_path = $f_sound_path;
} else {
if ($f_sound[$i] == "none") {
$card->f_sound_option = 0;
} else {
$card->f_sound_option = 1;
}
$card->f_sound = "";
$card->f_sound_path = "";
}
if (!empty($f_image[$i])) {
$f_image_file = "";
$f_image_path = "";
if ($f_image[$i] == "none") {
$card->f_image_option = 0;
} else {
$card->f_image_option = 0;
$f_image_pos = strripos($f_image[$i], "/");
$f_image_path = substr($f_image[$i], 0, $f_image_pos + 1);
$f_image_file = substr($f_image[$i], $f_image_pos + 1);
}
//.........这里部分代码省略.........
开发者ID:AxelPardemann,项目名称:E-Learning-System-based-on-Laravel-and-Bootstrap,代码行数:101,代码来源:SprintController.php