app/Api/V1/Controllers/TaskController.php
/**
     * Display a listing of the resource (get all task approvals that belong to me, or that I need to approve)
     *
     * @param Request $request
     * @return Task
     */
Display a listing of the resource (get all task approvals that belong to me, or that I need to approve)
@param Request $request
@return Task
Display a listing of the resource ( get all task approvals that belong to me or that I need to approve ) @param Request $request @return Task
public function index(Request $request)
    {
        $search = null;
        if ($request->input('search') != null) {
            $search = $request->input('search');
        }
        $task = Task::query();
        if (!is_null($search)) {
            $task = $task->where(function ($query) use ($search) {
                $query->where('description', 'like', '%' . $search . '%');
            });
        }
        return $task->owned()->with('approval.approvalDetails')
            ->with('module')
            ->with('taskType')
            ->withDates()
            ->get();
    }
public function index ( Request $ request ) { $ search = null ; if ( $ request -> input ( 'search' ) != null ) { $ search = $ request -> input ( 'search' ) ; } $ task = Task :: query ( ) ; if ( ! is_null ( $ search ) ) { $ task = $ task -> where ( function ( $ query ) use ( $ search ) { $ query -> where ( 'description' , 'like' , '%' . $ search . '%' ) ; } ) ; } return $ task -> owned ( ) -> with ( 'approval.approvalDetails' ) -> with ( 'module' ) -> with ( 'taskType' ) -> withDates ( ) -> get ( ) ; }
Display a listing of the resource (get all task approvals that belong to me, or that I need to approve)
 @param Request $request
 @return Task
Display a listing of the resource ( get all task approvals that belong to me or that I need to approve ) @param Request $request @return Task