classes/Controllers/Base.php
public function attach($id)
    {
        // Require there to be a parent id and a valid id for the resource
        $item = $this->findOrFail($id);

        // Do the attach
        $item->fireDecoyEvent('attaching', [$item, $this->parent]);
        $item->{$this->self_to_parent}()->attach($this->parent);
        $item->fireDecoyEvent('attached', [$item, $this->parent]);

        // Return the response
        return Response::json();
    }
public function attach($id)
    {
        // Require there to be a parent id and a valid id for the resource
        $item = $this->findOrFail($id);

        // Do the attach
        $item->fireDecoyEvent('attaching', [$item, $this->parent]);
        $item->{$this->self_to_parent}()->attach($this->parent);
        $item->fireDecoyEvent('attached', [$item, $this->parent]);

        // Return the response
        return Response::json();
    }
public function attach ( $ id ) { // Require there to be a parent id and a valid id for the resource $ item = $ this -> findOrFail ( $ id ) ; // Do the attach $ item -> fireDecoyEvent ( 'attaching' , [ $ item , $ this -> parent ] ) ; $ item -> { $ this -> self_to_parent } ( ) -> attach ( $ this -> parent ) ; $ item -> fireDecoyEvent ( 'attached' , [ $ item , $ this -> parent ] ) ; // Return the response return Response :: json ( ) ; }
Attach a model to a parent_id, like with a many to many style
autocomplete widget

@param  int                      $id The id of the parent model
@return Illuminate\Http\Response JSON
Attach a model to a parent_id like with a many to many style autocomplete widget