Homparty dev
This commit is contained in:
parent
9252094a04
commit
ac0d5b781e
60 changed files with 3443 additions and 293 deletions
|
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|||
use App\Models\Country;
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductImage;
|
||||
use App\Models\ProductIngredient;
|
||||
use App\Repositories\ProductRepository;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
|
@ -102,11 +103,25 @@ class ProductController extends Controller
|
|||
return redirect(route('admin_product_show'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$model = Product::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect(route('admin_product_show'));
|
||||
public function delete($id, $do = 'product', $did = null){
|
||||
if($do === 'product'){
|
||||
$model = Product::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect(route('admin_product_show'));
|
||||
}
|
||||
|
||||
if($do === 'ingredient'){
|
||||
$model = Product::findOrFail($id);
|
||||
$ProductIngredient = ProductIngredient::where('ingredient_id', $did)->where('product_id', $model->id)->first();
|
||||
if($ProductIngredient){
|
||||
$ProductIngredient->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect(route('admin_product_edit', [$model->id]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue