本文整理汇总了PHP中Color::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::where方法的具体用法?PHP Color::where怎么用?PHP Color::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color::where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postEditacolor
public function postEditacolor($id)
{
$material_color = MaterialColor::find($id);
$color = Color::where('id', $material_color->color_id)->firstorfail();
$color->nombre = Input::get('nombre_color');
$color->save();
$material = MaterialColor::where('id', $material_color->id)->firstorfail();
$material_color->material_id = Input::get('material_id');
$material->save();
return Redirect::action('InventarioRecubControlador@getColores');
}
示例2: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($palette_id, $color_id)
{
try {
$color = Color::where('palette_id', $palette_id)->findOrFail($color_id);
$color->fill(Input::all());
$color->validate();
$color->save();
return $this->respondOK(['data' => $this->transformer->transform($color)]);
} catch (ModelNotFoundException $e) {
return $this->respondNotFound();
} catch (ValidationException $e) {
return $this->respondNotAcceptable($e->getMessage());
} catch (Exception $e) {
return $this->respondBadRequest($e->getMessage());
}
}
示例3: saveTemplate
public function saveTemplate($truth_name, $tpl_name = '', $temptype = 0)
{
if ($tpl_name != '') {
$tpl_exists = Template::where('name', $tpl_name)->first();
if ($tpl_exists) {
$unpack_resuslt = $this->unpack($truth_name, $tpl_name, true, $temptype);
} else {
$tpl_exists = false;
$unpack_resuslt = $this->unpack($truth_name, $tpl_name, true, $temptype);
}
} else {
$tpl_exists = false;
$unpack_resuslt = $this->unpack($truth_name, $tpl_name, false, $temptype);
}
if ($unpack_resuslt) {
$tpl_info = $unpack_resuslt['config'];
if ($tpl_exists) {
$template = Template::find($tpl_exists->id);
} else {
$template = new Template();
$template->name = $unpack_resuslt['tpl_dir'];
$template->tpl_num = $unpack_resuslt['tpl_num'];
}
$template->tpl_name = $tpl_info['template']['tpl_name'];
$template->classify = $tpl_info['template']['classify'];
$template->demo = $tpl_info['template']['demo'];
$template->type = $tpl_info['template']['type'];
$template->description = $tpl_info['template']['description'];
$template->list1showtypetotal = $tpl_info['template']['list1showtypetotal'];
$template->list2showtypetotal = $tpl_info['template']['list2showtypetotal'];
$template->list3showtypetotal = $tpl_info['template']['list3showtypetotal'];
$template->list4showtypetotal = $tpl_info['template']['list4showtypetotal'];
$template->updated_at = date("Y-m-d H:i:s", time());
$insert_rst = $template->save();
if ($insert_rst) {
$insert_id = $template->id;
$color_arr = $tpl_info['tpl_color'];
$tpl_color = array();
$i = 0;
TemplateToColor::where('template_id', $insert_id)->delete();
if (count($color_arr) > 0) {
foreach ($color_arr as $color) {
$tpl_color[$i]['template_id'] = $insert_id;
$tpl_color[$i]['color_code'] = Config::get('color.' . $color);
$tpl_color[$i]['color_id'] = Color::where('color_en', $color)->pluck('id');
$i++;
}
TemplateToColor::insert($tpl_color);
}
}
$result = ['err' => 1000, 'msg' => '上传模板成功'];
} else {
$result = ['err' => 1003, 'msg' => '解压文件失败'];
}
return $result;
}