public function home()
 {
     $before = Carbon::today()->subYears(18)->format('Y-m-d');
     $dishes = $this->dish->all()->take(4);
     $data = array('dishes' => $dishes, 'before' => $before);
     return View('welcome')->with($data);
 }
 public function dishes()
 {
     $dish = Dish::all()->first();
     // var_dump($dish);
     $data = ['dish' => $dish];
     return View('dish')->with($data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $dishes = Dish::all();
     $data = ['dishes' => $dishes];
     return View('dishes.dishes')->with($data);
 }
Ejemplo n.º 4
0
 public static function listDishAdmin()
 {
     return Dish::all();
 }
Ejemplo n.º 5
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)];
});
Ejemplo n.º 6
0
 public function listDish()
 {
     $dishes = Dish::all();
     return $dishes;
 }
Ejemplo n.º 7
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return Dish::all();
 }