app/Http/Controllers/ServiceTypesController.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()
    {
        if(request()->wantsJson() || request()->expectsJson()) {
            $serviceTypes = Auth::user()->serviceTypes()->get();
            return DataTables::of($serviceTypes)->addColumn('actions', function($serviceType){
                return implode("", [
                    '<a href="' . route('service-types.edit', $serviceType) . '" data-original-title="' . __('messages.edit_service_type') . '" class="edit btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-edit"></i></a>',
                    '<a href="' . route('service-types.destroy', $serviceType) . '" class="deleteDataTableRecord btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-trash"></i></a>',
                ]);
            })->rawColumns(['actions'])->make(true);
        }
        $serviceType = new ServiceType;
        return view('serviceTypes.index', compact('serviceType'));
    }
public function index ( ) { if ( request ( ) -> wantsJson ( ) || request ( ) -> expectsJson ( ) ) { $ serviceTypes = Auth :: user ( ) -> serviceTypes ( ) -> get ( ) ; return DataTables :: of ( $ serviceTypes ) -> addColumn ( 'actions' , function ( $ serviceType ) { return implode ( " " , [ '<a href="' . route ( 'service-types.edit' , $ serviceType ) . '" data-original-title="' . __ ( 'messages.edit_service_type' ) . '" class="edit btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-edit"></i></a>' , '<a href="' . route ( 'service-types.destroy' , $ serviceType ) . '" class="deleteDataTableRecord btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-trash"></i></a>' , ] ) ; } ) -> rawColumns ( [ 'actions' ] ) -> make ( true ) ; } $ serviceType = new ServiceType ; return view ( 'serviceTypes.index' , compact ( 'serviceType' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .