예제 #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $suppliers = Supplier::all();
     $ingredients = Ingredient::all();
     $supplyorder = Supplyorder::find($id);
     return view('supplyorder.show', ['supplyorder' => $supplyorder, 'ingredients' => $ingredients, 'suppliers' => $suppliers]);
 }
예제 #2
0
 public function index()
 {
     $ingredients = Ingredient::all();
     foreach ($ingredients as $key => $item) {
         $ingredients[$key]['type'] = \App\Type::find($item->type_id);
     }
     return view('ingredient.index', array('ingredients' => $ingredients));
 }
예제 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $response = array();
     $ingredients = Ingredient::all('id', 'name');
     foreach ($ingredients as $ingredient) {
         array_push($response, ['label' => $ingredient->name, 'value' => $ingredient->id]);
     }
     return response()->json($response);
 }
예제 #4
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($tag_id = null)
 {
     if ($tag_id) {
         $ingredients = Ingredient::whereHas('tags', function ($query) use($tag_id) {
             $query->where('id', $tag_id);
         })->get();
     } else {
         $ingredients = Ingredient::all();
     }
     $tags = Tag::where('for', 'ingredient')->get();
     $tag = Tag::find($tag_id);
     return view('ingredients.index')->with(['ingredients' => $ingredients, 'tags' => $tags, 'the_tag' => $tag]);
 }
예제 #5
0
 public function count()
 {
     return Ingredient::all()->count();
 }
예제 #6
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function add($product)
 {
     $product = Product::find($product);
     $ingredients = Ingredient::all();
     return view('ingredient.add', ['ingredients' => $ingredients, 'product' => $product]);
 }
예제 #7
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function supply()
 {
     $measure = Ingredient::all();
     return view('metrics.supply', ['measure' => $measure]);
 }
 public function showIngredients()
 {
     $ingredients = \App\Ingredient::all();
     return view('ingredients', ['ingredients' => $ingredients]);
 }
 public function edit($id)
 {
     $product = Product::findOrFail($id);
     $ingredientsInProduct = $product->ingredients->all();
     $allIngredients = Ingredient::all();
     return view('manager.edit-product', compact('product', 'ingredientsInProduct', 'allIngredients'));
 }
 public function show()
 {
     return Ingredient::all();
 }
예제 #11
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $recipe = Recipe::find($id);
     $ingredients = Ingredient::all()->sortBy('name');
     $tags = Tag::where('for', 'recipe')->get();
     return view('recipes.edit')->with(['recipe' => $recipe, 'ingredients' => $ingredients, 'tags' => $tags]);
 }
예제 #12
0
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function (Faker\Generator $faker) {
    $firs_name = $faker->firstName;
    $last_name = $faker->lastName;
    return ['first_name' => $firs_name, 'last_name' => $last_name, 'full_name' => $firs_name . ' ' . $last_name, 'avatar' => config('application.files.avatars.public_path') . $faker->file(public_path(config('application.files.avatars.tmp_path')), public_path(config('application.files.avatars.public_path')), false), 'role' => 'user', 'email' => $faker->unique()->email, 'phone' => $faker->phoneNumber, 'password' => '123456'];
});
$factory->define(App\Category::class, function (Faker\Generator $faker) {
    $name = $faker->sentence(1);
    return ['name' => $name, 'description' => $faker->sentence(30), 'image' => config('application.files.categories.public_path') . $faker->file(public_path(config('application.files.categories.tmp_path')), public_path(config('application.files.categories.public_path')), false)];
});
$factory->define(App\Dish::class, function (Faker\Generator $faker) {
    $name = $faker->sentence(5);
    return ['name' => $name, 'description' => $faker->sentence(30), 'content' => $faker->sentence(50), 'image' => config('application.files.dishes.public_path') . $faker->file(public_path(config('application.files.dishes.tmp_path')), public_path(config('application.files.dishes.public_path')), false), 'difficulty' => $faker->randomElement(['low', 'half', 'high']), 'category_id' => \App\Category::all()->random()->id, 'user_id' => \App\User::all()->random()->id];
});
$factory->define(App\Ingredient::class, function (Faker\Generator $faker) {
    $name = $faker->sentence(2);
    return ['name' => $name, 'unit' => $faker->randomElement(config('application.units')), 'description' => $faker->sentence(30), 'image' => config('application.files.ingredients.public_path') . $faker->file(public_path(config('application.files.ingredients.tmp_path')), public_path(config('application.files.ingredients.public_path')), false), 'price' => $faker->randomFloat(2, 0, 3), 'user_id' => \App\User::all()->random()->id];
});
$factory->define(App\DishIngredient::class, function (Faker\Generator $faker) {
    return ['quantity' => $faker->randomNumber(2), 'unit' => $faker->randomElement(config('application.units')), 'description' => $faker->sentence(5), 'dish_id' => \App\Dish::all()->random()->id, 'ingredient_id' => \App\Ingredient::all()->random()->id, 'price' => $faker->randomFloat(2, 0, 3)];
});
예제 #13
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $ingredients = Ingredient::all();
     return view('pizzas.create', compact('ingredients'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $ingredients = Ingredient::all();
     return view('ingredients.index', compact('ingredients'));
 }
예제 #15
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $ingredients = Ingredient::all();
     return view('supplies.create')->with(['ingredients' => $ingredients]);
 }