app/Api/V1/Controllers/TaskTypeController.php
/**
     * Display a listing of the resource
     *
     * @param Request $request
     * @return TaskType
     */
Display a listing of the resource
@param Request $request
@return TaskType
Display a listing of the resource @param Request $request @return TaskType
public function index(Request $request)
    {
        $search = null;
        if ($request->input('search') != null) {
            $search = $request->input('search');
        }
        $taskType = TaskType::query();
        if (!is_null($search)) {
            $taskType = $taskType->where(function ($query) use ($search) {
                $query->where('name', 'like', '%' . $search . '%')
                    ->orWhere('description', 'like', '%' . $search . '%');
            });
        }
        return $taskType->withDates()->get();
    }
public function index ( Request $ request ) { $ search = null ; if ( $ request -> input ( 'search' ) != null ) { $ search = $ request -> input ( 'search' ) ; } $ taskType = TaskType :: query ( ) ; if ( ! is_null ( $ search ) ) { $ taskType = $ taskType -> where ( function ( $ query ) use ( $ search ) { $ query -> where ( 'name' , 'like' , '%' . $ search . '%' ) -> orWhere ( 'description' , 'like' , '%' . $ search . '%' ) ; } ) ; } return $ taskType -> withDates ( ) -> get ( ) ; }
Display a listing of the resource
 @param Request $request
 @return TaskType
Display a listing of the resource @param Request $request @return TaskType