当前位置: 首页>>代码示例>>PHP>>正文


PHP Recipe::exists方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:armourjami,项目名称:armourtake,代码行数:13,代码来源:Component.php

示例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');
     }
 }
开发者ID:armourjami,项目名称:armourtake,代码行数:20,代码来源:account.php

示例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());
 }
开发者ID:VedranBrnjetic,项目名称:BBCTestRecipe,代码行数:38,代码来源:starredRecipe.php

示例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 
}
?>
	
开发者ID:VedranBrnjetic,项目名称:BBCTestRecipe,代码行数:30,代码来源:recipe.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;
 }
开发者ID:usaphp,项目名称:listafe,代码行数:9,代码来源:recipes.php


注:本文中的Recipe::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。