コード例 #1
0
    /**
     * This function is used to display the list of Organizations
     * @return datatable
     */
    public function org_list()
    {
        return \Datatable::collection(Organization::all())->searchColumns('name')->orderColumns('name', 'website')->addColumn('name', function ($model) {
            return $model->name;
        })->addColumn('website', function ($model) {
            $website = $model->website;
            return $website;
        })->addColumn('phone', function ($model) {
            $phone = $model->phone;
            return $phone;
        })->addColumn('Actions', function ($model) {
            //return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
            //return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
            return '<span  data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href="' . route('organizations.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href="' . route('organizations.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
				<div class="modal fade" id="deletearticle' . $model->id . '">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">Are You Sure ?</h4>
                </div>
                <div class="modal-body">
                ' . $model->user_name . '
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
                    <a href="' . route('org.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>';
        })->make();
    }
コード例 #2
0
    /**
     * This function is used to display the list of Organizations
     * @return datatable
     */
    public function org_list()
    {
        // chumper datable package call to display Advance datatable
        return \Datatable::collection(Organization::all())->searchColumns('name')->orderColumns('name', 'website')->addColumn('name', function ($model) {
            // return $model->name;
            if (strlen($model->name) > 20) {
                $orgname = substr($model->name, 0, 25);
                $orgname = substr($orgname, 0, strrpos($orgname, ' ')) . ' ...';
            } else {
                $orgname = $model->name;
            }
            return $orgname;
        })->addColumn('website', function ($model) {
            $website = $model->website;
            return $website;
        })->addColumn('phone', function ($model) {
            $phone = $model->phone;
            return $phone;
        })->addColumn('Actions', function ($model) {
            // displaying action buttons
            // modal popup to delete data
            return '<span  data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href="' . route('organizations.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href="' . route('organizations.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
				<div class="modal fade" id="deletearticle' . $model->id . '">
			        <div class="modal-dialog">
			            <div class="modal-content">
                			<div class="modal-header">
                    			<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    			<h4 class="modal-title">Are You Sure ?</h4>
                			</div>
                			<div class="modal-body">
                				' . $model->user_name . '
                			</div>
                			<div class="modal-footer">
                    			<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
                    			<a href="' . route('org.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a>
                			</div>
            			</div><!-- /.modal-content -->
        			</div><!-- /.modal-dialog -->
    			</div>';
        })->make();
    }