app/Http/Controllers/RenewalFrequencyController.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()) {
            $renewalFrequencies = Auth::user()->renewalFrequencies()->get();
            return DataTables::of($renewalFrequencies)
                ->editColumn('type', function ($renewal) {
                    return RenewalFrequencies::getDescription($renewal->type);
                })->addColumn('actions', function($renewalFrequency){
                    return implode("", [
                        '<a href="' . route('renewal-frequencies.edit', $renewalFrequency) . '" data-original-title="' . __('messages.edit_renewal_frequency') . '" 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('renewal-frequencies.destroy', $renewalFrequency) . '" 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);
        }
        $renewalFrequency = new RenewalFrequency;
        return view('renewalFrequencies.index', compact('renewalFrequency'));
    }
public function index ( ) { if ( request ( ) -> wantsJson ( ) || request ( ) -> expectsJson ( ) ) { $ renewalFrequencies = Auth :: user ( ) -> renewalFrequencies ( ) -> get ( ) ; return DataTables :: of ( $ renewalFrequencies ) -> editColumn ( 'type' , function ( $ renewal ) { return RenewalFrequencies :: getDescription ( $ renewal -> type ) ; } ) -> addColumn ( 'actions' , function ( $ renewalFrequency ) { return implode ( " " , [ '<a href="' . route ( 'renewal-frequencies.edit' , $ renewalFrequency ) . '" data-original-title="' . __ ( 'messages.edit_renewal_frequency' ) . '" 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 ( 'renewal-frequencies.destroy' , $ renewalFrequency ) . '" 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 ) ; } $ renewalFrequency = new RenewalFrequency ; return view ( 'renewalFrequencies.index' , compact ( 'renewalFrequency' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .