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


PHP Recipe::find方法代码示例

本文整理汇总了PHP中Recipe::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Recipe::find方法的具体用法?PHP Recipe::find怎么用?PHP Recipe::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Recipe的用法示例。


在下文中一共展示了Recipe::find方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getEdit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function getEdit($id)
 {
     // get the recipe
     $recipe = Recipe::find($id);
     // show the edit form and pass the recipe
     return View::make('recipe.edit')->with('recipe', $recipe);
 }
开发者ID:JoshRamynke,项目名称:MealPlan-Web,代码行数:13,代码来源:RecipeController.php

示例2: sandbox

 public static function sandbox()
 {
     $first = Recipe::find(1);
     $recipes = Recipe::all();
     Kint::dump($recipes);
     Kint::dump($first);
 }
开发者ID:emivo,项目名称:Tsoha-Bootstrap,代码行数:7,代码来源:sandbox_controller.php

示例3: sandbox

 public static function sandbox()
 {
     // Testaa koodiasi täällä
     // View::make('helloworld.html');
     $indi = Recipe::find(1);
     $indis = Recipe::all();
     Kint::dump($indi);
     Kint::dump($indis);
 }
开发者ID:Rochet2,项目名称:Tsoha-Bootstrap,代码行数:9,代码来源:hello_world_controller.php

示例4: show

 public static function show($id)
 {
     $chef = Chef::find($id);
     if ($chef) {
         $recipes = Recipe::find_by_chef_id($chef->id);
         $comments = Comment::find_by_chef_id($chef->id);
         $recipes_for_comments = array();
         foreach ($comments as $comment) {
             $recipes_for_comments[$comment->recipe_id] = Recipe::find($comment->recipe_id);
         }
         View::make('chef/show.html', array('chef' => $chef, 'recipes' => $recipes, 'comments' => $comments, 'recipes_for_comments' => $recipes_for_comments));
     } else {
         Redirect::to('/', array('error' => 'Käyttäjää ei löytynyt'));
     }
 }
开发者ID:emivo,项目名称:Tsoha-Bootstrap,代码行数:15,代码来源:chef_controller.php

示例5: index

 /**
  * Display a listing of the resource.
  * GET /recipes
  *
  * @return Response
  */
 public function index()
 {
     // WORKING
     //$var = Recipe::find(1)->authors()->lists('name');
     //$var = Recipe::find(1)->photos()->lists('name');
     //$var = Recipe::find(1)->categories()->lists('name');
     //$var = Country::find(1)->recipes()->lists('title');
     //
     // ----  Pour les phrases de catégories -----
     // $var = Recipe::find(1)->categoriespreparation()->lists('name','id');
     // //$var = CategoriesPreparation::find(1)->sentencesprepatation()->lists('id');
     // $varkeys = array_keys($var);
     // $var2 = CategoriesPreparation::find($varkeys[1])->sentencespreparation()->lists('name');
     // BROKEN
     $var = Recipe::find(1)->countries();
     return Response::json($var);
 }
开发者ID:Defoncesko,项目名称:iamhungry,代码行数:23,代码来源:RecipesController.php

示例6: index

 public function index()
 {
     $this->recipes = Recipe::find();
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:4,代码来源:recipe_controller.php

示例7: Recipe

    //new recipe
    $editRecipe = 0;
    require_once "views/edit_recipe.php";
    die;
} else {
    if (isset($_GET['edit'])) {
        require_once "models/DB.php";
        require_once "models/Recipe.php";
        require_once "models/Ingredient.php";
        require_once "models/units_of_measure.php";
        require_once "models/Step.php";
        //pull ingredients and units of measure alphabetically from database
        $ing = Ingredient::findAll($dbh);
        $units = units_of_measure::findAll($dbh);
        $newEntry = new Recipe();
        $newEntry->find($_GET['edit'], $dbh);
        $steps = Step::findAllSteps($dbh, $_GET['edit']);
        $ingredients = Ingredient::findAllIngredients($dbh, $_GET['edit']);
        $editRecipe = 1;
        require_once "views/edit_recipe.php";
        die;
    }
}
// Route 1: user comes here to add a new recipe, show them a blank form
// Route 2: user comes here to edit a specific recipe
//   (you'll need to grab that id from the query string)
// Route 3a: user entered a new recipe details and is trying to save it
//   create an object, set values, validate and save, just like in the lab
//   if all is well, send to ShowRecipe to see the added recipe
//   otherwise, back to the edit view with errors!
// Route 3b: user updated an existing recipe details and is trying to save it
开发者ID:xavidram,项目名称:RecipeListPHP,代码行数:31,代码来源:EditRecipe.php

示例8: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $recipe = Recipe::find($id);
     $recipe->delete();
     return Response::json(array('success' => true));
 }
开发者ID:suhael,项目名称:laravel,代码行数:13,代码来源:RecipeController.php

示例9: Recipe

<?php

require_once "models/DB.php";
require_once "models/Recipe.php";
require_once "models/Ingredient.php";
require_once "models/units_of_measure.php";
require_once "models/RecipeIngredientUnit.php";
require_once "models/IngredientLayout.php";
require_once "models/Step.php";
// Route 1: user comes here to see a specific recipe
//   get the id of the recipe they want from the query string,
//   inflate a recipe model, and show them the detail view
//make new recipy and find it based on the ID of the selected anchor
$details = new Recipe();
$details->find($viewID, $dbh);
$steps = Step::findAllSteps($dbh, $details->id);
$riu = RecipeIngredientUnit::findAllForRecipe($details->id, $dbh);
$ingredients = array();
foreach ($riu as $i) {
    //$p = new IngredientLayout();
    //$p->amount = $i->amount;
    //$p->ingredient = Ingredient::findName($i->ingredient_id,$dbh);
    //$p->unit= units_of_measure::findName($i->unit_id,$dbh);
    //$ingredients[] = $p;
}
print_r($ingredients);
require_once "views/view_recipe.php";
开发者ID:xavidram,项目名称:RecipeListPHP,代码行数:27,代码来源:ShowRecipe.php

示例10: function

    return Redirect::to('recipe');
});
Route::post('recipe/image/upload', function () {
    // *** Include the class
    include dirname(__FILE__) . "/includes/imgresize.php";
    // *** 1) Initialise / load image
    // $resizeObj = new resize('sample.jpg');
    // // *** 2) Resize image (options: exact, portrait, landscape, auto, crop)
    // $resizeObj -> resizeImage(150, 150, 'crop');
    // // *** 3) Save image ('image-name', 'quality [int]')
    // $resizeObj -> saveImage('sample-resized.jpg', 100);
    $file = Input::file('file');
    $recipeId = Input::get('RecipeId');
    $upload_success = false;
    if (isset($recipeId)) {
        $recipe = Recipe::find($recipeId);
        if (isset($recipe)) {
            $destinationPath = 'img/recipe/upload';
            // If the uploads fail due to file system, you can try doing public_path().'/uploads'
            //$filename = Str::random(20).'.'.$file->getClientOriginalExtension();
            $filenameOrig = 'recipe-' . $recipeId . '-orig.' . $file->getClientOriginalExtension();
            $filename = 'recipe-' . $recipeId . '.' . $file->getClientOriginalExtension();
            $filenameThumb = 'recipe-' . $recipeId . '-thumb.' . $file->getClientOriginalExtension();
            $upload_success = Input::file('file')->move($destinationPath, $filenameOrig);
            $resize = new resize($destinationPath . '/' . $filenameOrig);
            $resize->resizeImage(500, 500, 'auto');
            $resize->saveImage($destinationPath . '/' . $filename, 100);
            $resize->resizeImage(300, 300, 'crop');
            $resize->saveImage($destinationPath . '/' . $filenameThumb, 100);
            $recipe->recipe_image = $destinationPath . '/' . $filename;
            $recipe->recipe_image_thumb = $destinationPath . '/' . $filenameThumb;
开发者ID:JoshRamynke,项目名称:MealPlan-Web,代码行数:31,代码来源:routes.php

示例11:

<?php

require_once "models/Recipe.php";
require_once "models/DB.php";
$idOfRecipe = $_GET["ID"];
$recipeItself = Recipe::find($idOfRecipe, $dbh, true);
$nameOfRecipe = $recipeItself->Name;
require_once "views/view_details.php";
开发者ID:bolivarez9193,项目名称:Brandons_Repo,代码行数:8,代码来源:RecipeDetail.php

示例12: Recipe

<br>
<br>
<?php 
// copyFromRow testing
$thisArray = ['ID' => 1001, 'Name' => "Bread", 'Description' => "It's Soft", 'Image' => "haha no", 'Prep' => "00:25", 'Total' => "05:00", 'Rating' => 4];
$recipe2 = new Recipe();
$recipe2->copyFromRow($thisArray);
print $recipe2;
?>
<br>
<br>
<?php 
// find testing
require_once "models/DB.php";
$recipe3 = new Recipe();
//$recipe3->ID = 1;
$recipe3->find(1, $dbh);
print $recipe3;
?>
<br>
<br>
<?php 
// findAll testing
$recipes = Recipe::findAll($dbh, true);
for ($i = 0; $i < count($recipes); $i++) {
    print $recipes[$i];
    ?>
<br>
<br>
<?php 
}
开发者ID:bolivarez9193,项目名称:Brandons_Repo,代码行数:31,代码来源:TestController.php

示例13: collect_content_for_show_recipe

 /**
  * @param $id
  * @return array
  */
 protected static function collect_content_for_show_recipe($id)
 {
     $recipe = Recipe::find($id);
     $comments = Comment::find_by_recipe_id($id);
     $commentators = array();
     foreach ($comments as $comment) {
         $commentators[$comment->chef_id] = Chef::find($comment->chef_id);
     }
     $ingredients = Ingredient::find_by_recipe_id($id);
     $keywords = Keyword::find_by_recipe_id($id);
     $chef = Chef::find($recipe->chef_id);
     $content = array('chef' => $chef, 'recipe' => $recipe, 'comments' => $comments, 'commentators' => $commentators, 'ingredients' => $ingredients, 'keywords' => $keywords);
     return $content;
 }
开发者ID:emivo,项目名称:Tsoha-Bootstrap,代码行数:18,代码来源:recipe_controller.php

示例14: Recipe

<?php

require_once "models/Unit.php";
require_once "models/Ingredient.php";
require_once "models/Recipe.php";
require_once "models/RecipeIngredientUnit.php";
require_once "models/db.php";
// Route 1: user comes here to see a specific recipe
//   get the id of the recipe they want from the query string,
//   inflate a recipe model, and show them the detail view
$recipe = new Recipe();
$recipe->find($_GET['id'], $dbh);
require_once "views/view_recipe.php";
开发者ID:elifah93,项目名称:Internet-Programming,代码行数:13,代码来源:ShowRecipe.php


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