本文整理汇总了PHP中Recipe::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Recipe::exists方法的具体用法?PHP Recipe::exists怎么用?PHP Recipe::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Recipe
的用法示例。
在下文中一共展示了Recipe::exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addComponent
public static function addComponent($dishId, $recipeId, $quantity, $unitName)
{
if (Unit::exists($newUnit) && Recipe::exists($recipeId)) {
$db = self::getInstance();
if ($db->insert('DishRecipes', ['Dishes_id' => $dishId, 'Recipes_id' => $recipeId, 'quantity' => $quantity, 'unit' => $unitName])) {
return true;
} else {
return false;
}
} else {
return false;
}
}
示例2: delete_recipe
public function delete_recipe()
{
$flash_string = '';
if (Session::exists('account')) {
$flash_string = Session::flash('account');
}
$user = new User();
if ($user->isLoggedIn()) {
if (Recipe::exists(Input::get('recipe_id'))) {
Recipe::deleteIngredient();
Session::flash('account', 'Recipe deleted');
} else {
Session::flash('account', 'Recipe could not be deleted');
}
Redirect::to('account/recipes');
} else {
Session::flash('home', 'You have been logged out, please log back in');
Redirect::to('home');
}
}
示例3: unstarRecipe
function unstarRecipe($usr, $recipe_id)
{
$con1 = new SQLconnection();
$user = new User($usr);
$recipe = new Recipe($recipe_id);
if ($recipe->exists()) {
//$table="Starred";
//$conditions=array();
//$user_id=new stdClass();
//$user_id->column="user_id";
//$user_id->value=$user->id();
//$user_id->compare="=";
//$user_id->logical="and";
//$recipe_id1=new stdClass();
//$recipe_id1->column="recipe_id";
//$recipe_id1->value=$recipe->id();
//$recipe_id1->compare="=";
//$recipe_id1->logical="";
//$conditions=array($user_id,$recipe_id1);
try {
if (!($usr = (int) $usr)) {
return;
}
if (!($recipe_id = (int) $recipe_id)) {
return;
}
$con1->pdo_query(" delete from Starred where user_id = {$usr} and recipe_id={$recipe_id};");
//$con1->pdo_delete($table,$conditions);
} catch (PDOException $Exception) {
print_r($Exception);
$res = $Exception;
return $res;
}
}
unset($this->recipes);
$this->recipes = array();
$this->loadRecipes($user->id());
}
示例4:
}
?>
</tbody>
</table>
<?php
} else {
echo "<p>Sorry, you don't currently have any starred recipes, get started by starring recipes you like</p>";
}
?>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-8">
<div class="thumbnail">
<?php
if ($recipe->exists()) {
?>
<img id="recipe-photo" src="<?php
echo "images/recipes/" . $recipe->imageUrl();
?>
" title="<?php
echo $recipe->name();
?>
photo" alt="<?php
echo $recipe->name();
?>
photo">
<?php
}
?>
示例5: Recipe
function _recipe_name_exists($recipe_name)
{
$recipe = new Recipe();
$recipe->where('name', $recipe_name)->get();
if ($recipe->exists()) {
return false;
}
return true;
}