*/ class OrganizationController extends Controller { /** * Create a new controller instance. * constructor to check * 1. authentication * 2. user roles * 3. roles must be agent * @return void */ public function __construct() { // checking for authentication $this->middleware('auth'); // checking if the role is agent $this->middleware('role.agent'); } /** * Display a listing of the resource. * @param type Organization $org * @return type Response */ public function index() { try { /* get all values of table organization */ return view('themes.default1.agent.helpdesk.organization.index'); } catch (Exception $e) { return view('404'); } } /** * 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()) /* searchable name */ ->searchColumns('name') /* order by name and website */ ->orderColumns('name', 'website') /* column name */ ->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; }) /* column website */ ->addColumn('website', function ($model) { $website = $model->website; return $website; }) /* column phone number */ ->addColumn('phone', function ($model) { $phone = $model->phone; return $phone; }) /* column action buttons */ ->addColumn('Actions', function ($model) { // displaying action buttons // modal popup to delete data return ' ' . \Lang::get('lang.delete') . ' ' . \Lang::get('lang.edit') . ' ' . \Lang::get('lang.view') . '