Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function create($id)
- {
- $type = Type::find($id);
- $category = Category::all();
- foreach ($type->field as $key => $value) {
- if (Schema::hasColumn('products', "{$value->fieldname}")) {
- return view('products.create', compact('type', 'category'));
- } else
- {if (!Schema::hasColumn('products', "{$value->fieldname}")) {
- foreach ($type->field as $key => $value) {
- Schema::table('products', function ($table) use ($value) {
- $table->string("{$value->fieldname}")->nullable()-> after('category_id');
- });
- }
- return view('products.create', compact('type', 'category'));
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment