app/Api/V1/Controllers/DocumentFormatsController.php
/**
     * Display a listing of the resource.
     * 
     * @return json
     *
     */
Display a listing of the resource.

@return json
Display a listing of the resource . @return json
public function index(Request $request)
    {
        $search = null;
        if ($request->input('filter') != null) {
            $search = $request->input('filter');
        }
        $documentFormat = DocumentFormat::query();
        if (!is_null($search)) {
            $documentFormat = $documentFormat->where(function ($query) use ($search) {
                $query->where('extension', 'like', '%' . $search . '%')
                    ->orWhere('mime_type', 'like', '%' . $search . '%')
                    ->orWhere('description', 'like', '%' . $search . '%');
            });
        }
        return $documentFormat->withDates()->get();
    }
public function index ( Request $ request ) { $ search = null ; if ( $ request -> input ( 'filter' ) != null ) { $ search = $ request -> input ( 'filter' ) ; } $ documentFormat = DocumentFormat :: query ( ) ; if ( ! is_null ( $ search ) ) { $ documentFormat = $ documentFormat -> where ( function ( $ query ) use ( $ search ) { $ query -> where ( 'extension' , 'like' , '%' . $ search . '%' ) -> orWhere ( 'mime_type' , 'like' , '%' . $ search . '%' ) -> orWhere ( 'description' , 'like' , '%' . $ search . '%' ) ; } ) ; } return $ documentFormat -> withDates ( ) -> get ( ) ; }
Display a listing of the resource.
Display a listing of the resource .