public function onForm($id = 0) { Meta::title(Lang::get('meta.role add')); Meta::meta('description', Lang::get('meta.role add description')); $Model = \App\Models\Role::select(['id', 'name', 'description', 'active', 'authorize', 'created_at'])->where('id', $id)->first(); return Theme::view('roles.form', ['data' => $Model]); }
public function onForm($id = 0) { Meta::title(Lang::get('meta.companies add')); Meta::meta('description', Lang::get('meta.companies add description')); $Model = \App\Models\Company::select(['id', '_id', 'name', 'active'])->where('id', $id)->first(); return Theme::view('companies.form', ['data' => $Model]); }
/** * Index Layout * * @return @Theme View */ public function onPageUserInformation() { Meta::title(Lang::get('meta.user information')); Meta::meta('description', Lang::get('meta.user information description')); $query = \App\Models\User::leftJoin('roles', 'roles.id', '=', 'users.role_id')->leftJoin('companies', 'companies.id', '=', 'users.company_id')->select('users.*')->where('roles.authorize', '=', '0'); if (Auth::user()->authorize() != 1) { $query = $query->where('users.company_id', '=', Auth::user()->company_id); } $query = $query->addSelect('roles.name as role_name')->addSelect('companies._id as company_id')->addSelect('companies.name as company_name'); $grid = new Grid((new GridConfig())->setDataProvider(new EloquentDataProvider($query))->setName('grid')->setPageSize(15)->setColumns([(new FieldConfig())->setName('email')->setLabel(Lang::get('label.email'))->setSortable(true), (new FieldConfig())->setName('first_name')->setLabel(Lang::get('label.first name'))->setSortable(true), (new FieldConfig())->setName('last_name')->setLabel(Lang::get('label.last name'))->setSortable(true), (new FieldConfig())->setName('information')->setLabel(Lang::get('label.leave entitlement'))->setSortable(true), (new FieldConfig())->setName('active')->setLabel(Lang::get('label.active'))->setSortable(false)->setCallback(function ($val) { return '<a href="javascript:active(\'' . $val . '\')"><center><i class="fa ' . ($val ? 'fa-check' : 'fa-close') . '"></i></center></a>'; })])); $grid2 = new Grid((new GridConfig())->setDataProvider(new EloquentDataProvider(\App\Models\Information::leftJoin('users', 'users.id', '=', 'informations.created_by')->leftJoin('information_companies', 'information_companies.information_id', '=', 'informations.id')->select('informations.*')->addSelect("users.first_name as upload_name")->where("information_companies.company_id", Auth::user()->company_id)->addSelect("informations.created_at as upload_at")))->setName('grid')->setPageSize(15)->setColumns([(new FieldConfig())->setName('name')->setLabel(Lang::get('label.name'))->setSortable(false)->setCallback(function ($val) { return '<a href="' . url('file/information/download/' . $val) . '">' . $val . '</a>'; }), (new FieldConfig())->setName('description')->setLabel(Lang::get('label.description'))->setSortable(true), (new FieldConfig())->setName('upload_name')->setLabel(Lang::get('label.upload by'))->setSortable(true), (new FieldConfig())->setName('upload_at')->setLabel(Lang::get('label.upload at'))->setSortable(true)])); return Theme::view('users.pages.user-information', compact('grid', 'grid2', 'text')); }
/** * Function OnInformationForm * to View Form User * @Request @Name,@Code etc * * @return json */ public function onInformationForm($id = 0) { Meta::title(Lang::get('meta.file information add')); Meta::meta('description', Lang::get('meta.file information add description')); $Model = \App\Models\Information::select(['id', 'mime', 'name', 'description', 'active', 'created_by'])->where('id', $id)->first(); return Theme::view('files.information-form', ['data' => $Model]); }