本文整理汇总了PHP中Option::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::where方法的具体用法?PHP Option::where怎么用?PHP Option::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Option
的用法示例。
在下文中一共展示了Option::where方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
* PUT /exp/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
if (Input::get('password') != 'admin8888') {
return Redirect::route('exp.index');
}
$option = Option::where('key', '=', 'exp')->first();
$option->value = date(Input::get('value'));
$option->save();
return Redirect::route('home');
}
示例2: get
public static function get($varname, $defvalue = null)
{
$opt = Option::where('varname', $varname)->first();
if ($opt) {
return $opt->value;
} else {
return is_null($value) ? '' : $defvalue;
//return specified default value
}
}
示例3: set
/**
* Set an option
* @param string $key, string $value
* @return boolean
*/
public static function set($key, $value)
{
if (self::has($key)) {
$option = Option::where('key', '=', $key)->first();
if (!empty($option)) {
$option->value = $value;
if ($option->save()) {
Cache::forget('options');
return true;
}
}
}
return false;
}
示例4: credits2euro
static function credits2euro($credits = 0, $comma = true)
{
$dinero = (double) Option::where('option_key', 'credit_euro_' . $credits)->pluck('option_value');
if (!$dinero) {
$dinero = (double) Option::where('option_key', 'credit_euro')->pluck('option_value');
}
$formateado = sprintf("%01.2f", $dinero * $credits);
//$formateado = round(sprintf("%01.2f", $dinero * $credits),2);
if ($comma) {
$formateado = str_replace(".", ",", $formateado);
}
return $formateado;
}
示例5: encryption
/**
* post encryption
*
* @return string
*/
public static function encryption()
{
$encryption = Option::where('option_name', '=', 'encryption')->first();
$encryptvalue = $encryption->option_value;
return $encryptvalue;
}
示例6: postConfigSave
public function postConfigSave()
{
if (Payment::VeryPayment() == false) {
return View::make('clinic.payment.renews-payment');
}
$data = array("name" => Input::get("name"), "insurance" => Input::get("insurance"), "lang" => Input::get("lang"), "picture" => Input::file("picture"), "phone" => Input::get("phone"));
$rules = array("name" => 'required|min:1|max:255', "insurance" => 'required|min:1|max:255', "lang" => 'required|min:1|max:10', "picture" => 'mimes:jpeg,gif,png', "phone" => 'required|numeric|min:1');
$messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'numeric' => 'El campo :attribute debe contener solo numeros', 'mimes' => 'El formato de la imagen :attribute debe ser jpg, git, png');
$validation = Validator::make(Input::all(), $rules, $messages);
//si la validación falla redirigimos al formulario de registro con los errores
//y con los campos que nos habia llenado el usuario
if ($validation->fails()) {
return Redirect::to('/clinic/config-data/')->withErrors($validation)->withInput();
} else {
$id = Input::get("id");
$clinic = Clinic::find($id);
$clinic->name = Input::get("name");
$clinic->phone = Input::get("phone");
$clinic->insurances = Input::get("insurance");
if (Input::file('picture') != NULL) {
//agrega imagen de logo
$file_logo = Input::file('picture');
$ext = Input::file('picture')->getClientOriginalExtension();
$nameIMG = date('YmdHis');
$logo = $nameIMG . '.' . $ext;
$logo = 'assets/clinic/images/logo/logo_' . $logo;
$file_logo->move("assets/clinic/images/logo/", $logo);
$clinic->picture = $logo;
}
$clinic->save();
$adress = Address::find($clinic->address_id);
$adress->my_address = Input::get("address");
$adress->save();
$lang = Option::where('name', $clinic->id . '-clinic-lang')->first();
if ($lang) {
$lang->key = Input::get("lang");
$lang->save();
} else {
$langadd = new Option();
$langadd->key = Input::get("lang");
$langadd->name = $clinic->id . '-clinic-lang';
$langadd->save();
}
return Redirect::back();
}
}
示例7: delete_tag
public function delete_tag()
{
$id = Request::segment(4);
$tag = Option::find($id);
Option::where('id', $id)->delete();
$message = "Successfully deleted the product tag";
$type = "success";
return Redirect::to('/admin/tags')->with('type', $type)->with('message', $message);
}
示例8: function
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
if (Session::token() !== Input::get('_token')) {
throw new Illuminate\Session\TokenMismatchException();
}
});
/*
|--------------------------------------------------------------------------
| EXP Protection Filter
|--------------------------------------------------------------------------
*/
Route::filter('exp', function () {
$option = Option::where('key', '=', 'exp')->first();
$exp = date($option->value);
$now = date('Y-m-d 08:i:s');
if (strtotime($now) > strtotime($exp)) {
return '';
}
});
/*
|--------------------------------------------------------------------------
| Admin Filter
|--------------------------------------------------------------------------
*/
Route::filter('admin', function () {
if (Auth::user()->id != 1 && Auth::user()->id != 2) {
return '';
}
示例9: getConfigSave
public function getConfigSave()
{
if (Payment::VeryPayment() == false) {
return View::make('clinic.payment.renews-payment');
}
$data = array("insurance" => Input::get("insurance"), "lang" => Input::get("lang"));
$rules = array("insurance" => 'required|min:1|max:100', "lang" => 'required|min:1|max:100');
$messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'numeric' => 'El campo :attribute debe contener solo numeros', 'mimes' => 'El formato de la imagen logo debe ser jpg, git, png');
$validation = Validator::make(Input::all(), $rules, $messages);
//si la validación falla redirigimos al formulario de registro con los errores
//y con los campos que nos habia llenado el usuario
if ($validation->fails()) {
return Redirect::to('/clinic/config-data/')->withErrors($validation)->withInput();
} else {
$id = Doctor::doctorLogin();
$doctor = Doctor::where('id', $id)->first();
$lang = Option::where('name', $id . '-doctor-lang')->first();
if ($lang) {
$lang->key = Input::get("lang");
$lang->save();
} else {
$langadd = new Option();
$langadd->key = Input::get("lang");
$langadd->name = $id . '-doctor-lang';
$langadd->save();
}
$opcionSeg = Option::where('name', $id . '-doctor-insurance')->first();
if ($opcionSeg) {
$segs = explode(',', Input::get("insurance"));
$segok = '';
foreach ($segs as $seg) {
$very = Insurance::where('name', 'like', '%' . $seg . '%')->first();
if ($very) {
$segok = $segok . ',' . $seg;
}
}
$opcionSeg->key = $segok;
$opcionSeg->save();
} else {
$segs = explode(',', Input::get("insurance"));
$seguok = '';
foreach ($segs as $seg) {
$very = Insurance::where('name', $seg)->first();
if ($very) {
$seguok = $seguok . ',' . $seg;
}
}
$addseg = new Option();
$addseg->name = $id . '-doctor-insurance';
$addseg->key = $seguok;
$addseg->save();
}
return Redirect::back();
}
}