app/Http/Controllers/CommunicationNomenclatureController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request, CommunicationNomenclature $nomenclatures)
    {
        $total_nomenclatures = CommunicationNomenclature::count();
        $search = $request->get('search');
        if ($search != "") {
            $nomenclatures = CommunicationNomenclature::where('equipment_code', 'LIKE', '%' . $search . '%')->latest()->paginate(10)->setPath('');
            if (isset($nomenclatures)) {
                $pagination = $nomenclatures->appends(array(
                    'search' => $request->get('search')
                ));
                if (count($nomenclatures) > 0) {
                    return view('references.c4s.nomenclature.index', 
                    [
                        'total_nomenclatures' => $total_nomenclatures,
                        'nomenclatures' => $nomenclatures
                    ])
                    ->withStatus($nomenclatures)->withQuery($search);
                }
                $records = 'No';
                return view('references.c4s.nomenclature.index', 
                [
                    'records' => $records, 
                    'total_nomenclatures' => $total_nomenclatures,
                    'nomenclatures' => $nomenclatures
                ])
                ->withStatus($nomenclatures)->withQuery($search);
            }
        }
        return view('references.c4s.nomenclature.index', 
        [
            'total_nomenclatures' => $total_nomenclatures,
            'nomenclatures' => $nomenclatures->latest()->paginate(10)
        ]);
    }
public function index ( Request $ request , CommunicationNomenclature $ nomenclatures ) { $ total_nomenclatures = CommunicationNomenclature :: count ( ) ; $ search = $ request -> get ( 'search' ) ; if ( $ search != " " ) { $ nomenclatures = CommunicationNomenclature :: where ( 'equipment_code' , 'LIKE' , '%' . $ search . '%' ) -> latest ( ) -> paginate ( 10 ) -> setPath ( '' ) ; if ( isset ( $ nomenclatures ) ) { $ pagination = $ nomenclatures -> appends ( array ( 'search' => $ request -> get ( 'search' ) ) ) ; if ( count ( $ nomenclatures ) > 0 ) { return view ( 'references.c4s.nomenclature.index' , [ 'total_nomenclatures' => $ total_nomenclatures , 'nomenclatures' => $ nomenclatures ] ) -> withStatus ( $ nomenclatures ) -> withQuery ( $ search ) ; } $ records = 'No' ; return view ( 'references.c4s.nomenclature.index' , [ 'records' => $ records , 'total_nomenclatures' => $ total_nomenclatures , 'nomenclatures' => $ nomenclatures ] ) -> withStatus ( $ nomenclatures ) -> withQuery ( $ search ) ; } } return view ( 'references.c4s.nomenclature.index' , [ 'total_nomenclatures' => $ total_nomenclatures , 'nomenclatures' => $ nomenclatures -> latest ( ) -> paginate ( 10 ) ] ) ; }
Display a listing of the resource.
Display a listing of the resource .