/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $types = Image_type::all(); $image = Image::find($id); //todo show error on false id return view('image.edit', ['types' => $types, 'image' => $image]); }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('image_types', function (Blueprint $table) { $table->increments('id'); $table->string('type'); }); $types = [['type' => 'hair'], ['type' => 'makeup'], ['type' => 'beforeandafter']]; foreach ($types as $type) { Image_type::create($type); } }