jeudi 29 mars 2018

Load different methods depending on which view is being browsed LARAVEL

Trying to load different views and methods depending on which view the user is browsing.

Views:

public function edit()
{    
    if("SOMETHING")return View::make('store_edit');
    If("SOMETHING")return View::make('product_edit');
}

Methods:

public function destroy($id)
{
    if(SOMETHING){
       $store = Store::find($id);
       $store->delete();
       return redirect('/store');
     }
    if(SOMETHING){
       $product = Product::find($id);
       $product->delete();
       return redirect('/product');
      }
}

What can be used in the if() statements depending on which view is browsed in order to delete the right item and not having to rewrite the functions for each table.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Gm7do6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire