classes/Controllers/Base.php
public function remove($id)
    {
        // Support removing many ids at once
        $ids = Request::has('ids') ? explode(',', request('ids')) : [$id];

        // Get the model instances for each id, for the purpose of event firing
        $items = array_map(function ($id) {
            return $this->findOrFail($id);
        }, $ids);

        // Lookup up the parent model so we can bulk remove multiple of THIS model
        foreach ($items as $item) {
            $item->fireDecoyEvent('removing', [$item, $this->parent]);
        }
        $this->parentRelation()->detach($ids);
        foreach ($items as $item) {
            $item->fireDecoyEvent('removed', [$item, $this->parent]);
        }

        // Redirect.  We can use back cause this is never called from a "show"
        // page like get_delete is.
        if (Request::ajax()) {
            return Response::json();
        }

        return Redirect::back();
    }
public function remove($id)
    {
        // Support removing many ids at once
        $ids = Request::has('ids') ? explode(',', request('ids')) : [$id];

        // Get the model instances for each id, for the purpose of event firing
        $items = array_map(function ($id) {
            return $this->findOrFail($id);
        }, $ids);

        // Lookup up the parent model so we can bulk remove multiple of THIS model
        foreach ($items as $item) {
            $item->fireDecoyEvent('removing', [$item, $this->parent]);
        }
        $this->parentRelation()->detach($ids);
        foreach ($items as $item) {
            $item->fireDecoyEvent('removed', [$item, $this->parent]);
        }

        // Redirect.  We can use back cause this is never called from a "show"
        // page like get_delete is.
        if (Request::ajax()) {
            return Response::json();
        }

        return Redirect::back();
    }
public function remove ( $ id ) { // Support removing many ids at once $ ids = Request :: has ( 'ids' ) ? explode ( ',' , request ( 'ids' ) ) : [ $ id ] ; // Get the model instances for each id, for the purpose of event firing $ items = array_map ( function ( $ id ) { return $ this -> findOrFail ( $ id ) ; } , $ ids ) ; // Lookup up the parent model so we can bulk remove multiple of THIS model foreach ( $ items as $ item ) { $ item -> fireDecoyEvent ( 'removing' , [ $ item , $ this -> parent ] ) ; } $ this -> parentRelation ( ) -> detach ( $ ids ) ; foreach ( $ items as $ item ) { $ item -> fireDecoyEvent ( 'removed' , [ $ item , $ this -> parent ] ) ; } // Redirect.  We can use back cause this is never called from a "show" // page like get_delete is. if ( Request :: ajax ( ) ) { return Response :: json ( ) ; } return Redirect :: back ( ) ; }
Remove a relationship.  Very similar to delete, except that we're
not actually deleting from the database
@param  mixed                    $id One or many (commaa delimited) parent ids
@return Illuminate\Http\Response Either a JSON or Redirect response
Remove a relationship . Very similar to delete except that we re not actually deleting from the database