本文整理汇总了PHP中Templates::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Templates::find方法的具体用法?PHP Templates::find怎么用?PHP Templates::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Templates
的用法示例。
在下文中一共展示了Templates::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postGetLetterTemplate
public function postGetLetterTemplate($id)
{
$row = Templates::find($id);
$data = unserialize($row->array);
echo json_encode($data);
}
示例2: postGetPeTemplates
public function postGetPeTemplates($group, $id, $default)
{
if ($default == 'y' && $id == '0') {
$gender = Session::get('gender');
if ($gender == 'male') {
$sex = 'm';
} elseif ($gender == 'female') {
$sex = 'f';
} else {
$sex = 'u';
}
$row = DB::table('templates')->where('user_id', '=', '0')->where('sex', '=', $sex)->where('category', '=', 'pe')->where('group', '=', $group)->where('default', '=', "default")->first();
$data = unserialize($row->array);
$data1 = json_encode($data);
} else {
$row = Templates::find($id);
$data = unserialize($row->array);
$data1 = json_encode($data);
$data1 = str_replace('pe_form_buttonset', 'pe_buttonset', $data1);
$data1 = str_replace('pe_form', $group, $data1);
}
echo $data1;
}
示例3: postSaveReferralForm
public function postSaveReferralForm($type)
{
if ($type == 'user') {
$user_id = Session::get('user_id');
} else {
$user_id = "0";
}
$group = str_replace(" ", "_", strtolower(Input::get('template_name')));
$array = serialize(Input::get('array'));
if (Input::get('sex') == 'b') {
$template_data1 = array('user_id' => $user_id, 'default' => 'default', 'template_name' => Input::get('template_name'), 'age' => Input::get('age'), 'category' => 'referral', 'sex' => 'm', 'group' => $group, 'array' => $array, 'practice_id' => Session::get('practice_id'));
$template_data2 = array('user_id' => $user_id, 'default' => 'default', 'template_name' => Input::get('template_name'), 'age' => Input::get('age'), 'category' => 'referral', 'sex' => 'f', 'group' => $group, 'array' => $array, 'practice_id' => Session::get('practice_id'));
$template_data3 = array('user_id' => $user_id, 'default' => 'default', 'template_name' => Input::get('template_name'), 'age' => Input::get('age'), 'category' => 'referral', 'sex' => 'u', 'group' => $group, 'array' => $array, 'practice_id' => Session::get('practice_id'));
if (Input::get('template_id') == '') {
DB::table('templates')->insert($template_data1);
$this->audit('Add');
DB::table('templates')->insert($template_data2);
$this->audit('Add');
DB::table('templates')->insert($template_data3);
$this->audit('Add');
$message = "Form added as a template!";
} else {
$template_row = Templates::find(Input::get('template_id'));
if ($template_row->sex == 'm') {
$template_id1 = Input::get('template_id');
} elseif ($template_row->sex == 'f') {
$template_id2 = Input::get('template_id');
} else {
$template_id3 = Input::get('template_id');
}
$template_row1 = Templates::where('group', '=', $template_row->group)->where('template_id', '!=', Input::get('template_id'))->get();
if ($template_row1) {
foreach ($template_row1 as $template_row1_row) {
if ($template_row1->sex == 'm') {
$template_id1 = $template_row1->template_id;
} elseif ($template_row1->sex == 'f') {
$template_id2 = $template_row1->template_id;
} else {
$template_id3 = $template_row1->template_id;
}
}
DB::table('templates')->where('template_id', '=', $template_id1)->update($template_data1);
$this->audit('Update');
DB::table('templates')->where('template_id', '=', $template_id2)->update($template_data2);
$this->audit('Update');
DB::table('templates')->where('template_id', '=', $template_id3)->update($template_data3);
$this->audit('Update');
} else {
if ($template_row->sex == 'm') {
DB::table('templates')->insert($template_data2);
$this->audit('Add');
DB::table('templates')->insert($template_data3);
$this->audit('Add');
} elseif ($template_row->sex == 'f') {
DB::table('templates')->insert($template_data1);
$this->audit('Add');
DB::table('templates')->insert($template_data3);
$this->audit('Add');
} else {
DB::table('templates')->insert($template_data1);
$this->audit('Add');
DB::table('templates')->insert($template_data2);
$this->audit('Add');
}
}
$message = "Form updated as a template!";
}
} else {
$template_data4 = array('user_id' => $user_id, 'default' => 'default', 'template_name' => Input::get('template_name'), 'age' => Input::get('age'), 'category' => 'referral', 'sex' => Input::get('sex'), 'group' => $group, 'array' => $array, 'practice_id' => Session::get('practice_id'));
if (Input::get('template_id') == '') {
DB::table('templates')->insert($template_data4);
$this->audit('Add');
$message = "Form added as a template!";
} else {
DB::table('templates')->where('template_id', '=', Input::get('template_id'))->update($template_data4);
$this->audit('Update');
$message = "Form updated as a template!";
}
}
echo $message;
}