Code Duplication    Length = 17-20 lines in 2 locations

app/Http/Controllers/Agent/helpdesk/UserController.php 1 location

@@ 846-865 (lines=20) @@
843
        }
844
    }
845
846
    public function UsereditAssignOrg($id)
847
    {
848
        $org_name = Input::get('org');
849
850
        if ($org_name) {
851
            $org = Organization::where('name', '=', $org_name)->lists('id')->first();
852
            if ($org) {
853
                $user_org = User_org::where('user_id', '=', $id)->first();
854
                $user_org->org_id = $org;
855
                $user_org->user_id = $id;
856
                $user_org->save();
857
858
                return 1;
859
            } else {
860
                return 0;
861
            }
862
        } else {
863
            return 2;
864
        }
865
    }
866
867
    public function orgAssignUser($id)
868
    {

app/Http/Controllers/Api/v1/TicketController.php 1 location

@@ 673-689 (lines=17) @@
670
     *
671
     * @return type
672
     */
673
    public function userremove()
674
    {
675
        $email = Input::get('email');
676
        $ticketid = Input::get('ticketid');
677
        $user = new User();
678
        $user = $user->where('email', $email)->first();
679
        $ticket_collaborator = Ticket_Collaborator::where('ticket_id', '=', $ticketid)
680
                ->where('user_id', $user->id)
681
                ->first();
682
        if ($ticket_collaborator) {
683
            $ticket_collaborator->delete();
684
685
            return 'deleted successfully';
686
        } else {
687
            return 'not found';
688
        }
689
    }
690
691
    public function getCollaboratorForTicket()
692
    {