本文整理汇总了PHP中sentinel函数的典型用法代码示例。如果您正苦于以下问题:PHP sentinel函数的具体用法?PHP sentinel怎么用?PHP sentinel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sentinel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($id)
{
$this->form_validation->set_rules('name', 'Name', 'trim|required');
if ($this->form_validation->run() == FALSE) {
$group = sentinel()->findRoleBySlug('edt');
$data['kategori'] = Model\Portal\Category::findOrFail($id);
$data['kategori_lists'] = $this->model->getLists($id);
$data['users'] = $group->users->pluck('email', 'id')->toArray();
$this->template->build('kategori_edit', $data);
} else {
$kategori['name'] = $this->input->post('name');
$kategori['description'] = $this->input->post('description');
$kategori['parent'] = $this->input->post('parent');
$editor = set_value('editor', []);
$category = Model\Portal\Category::findOrFail($id);
$category->update($kategori);
$category->editors()->sync($editor);
if ($res == TRUE) {
set_message_success('Kategori berhasil diperbarui.');
redirect('kategori');
} else {
set_message_error('Kategori gagal diperbarui.');
redirect('kategori/update');
}
}
}
示例2: getKatByUser
public function getKatByUser()
{
$user_id = sentinel()->getUser()->id;
$data = array('konsultasi_kategori.name', 'konsultasi_kategori.description', 'konsultasi_user_has_kategori.*');
$get = $this->db->select($data)->from('konsultasi_user_has_kategori')->join('konsultasi_kategori', 'konsultasi_user_has_kategori.id_kategori=konsultasi_kategori.id')->where('konsultasi_user_has_kategori.user_id', $user_id)->get();
return $get->result();
}
示例3: detail
public function detail($id)
{
$this->form_validation->set_rules('isi', 'Isi', 'required');
if ($this->form_validation->run() == FALSE) {
$detail['konsultasi'] = $this->M_konsultasi->getByIdKonsultasi($id);
$detail['kategori'] = $this->M_konsultasi->getKatByKons($id);
$balasan = collect($this->M_konsultasi->getReply($id));
$detail['reply'] = pagination($balasan, 3, 'konsultasi/detail/' . $id, 'bootstrap_md');
$this->template->build('detail', $detail);
} else {
$config['upload_path'] = PATH_KONSULTASI_ATTACHMENT;
$config['allowed_types'] = 'gif|jpg|jpeg|png|pdf|doc|xls|xlsx|docx|zip|txt|ppt|pptx';
$config['max_size'] = '10000';
$this->load->library('upload', $config);
if (!$this->upload->do_upload('files')) {
$reply = array('isi' => set_value('isi', '', FALSE), 'id_konsultasi' => $id, 'id_user' => sentinel()->getUser()->id);
$updateat = date('Y-m-d H:i:s');
} else {
$file_data = $this->upload->data();
$reply = array('attachment' => $file_data['file_name'], 'isi' => set_value('isi', '', FALSE), 'id_konsultasi' => $id, 'id_user' => sentinel()->getUser()->id);
$updateat = date('Y-m-d H:i:s');
}
$id_konsultasi = set_value('id_konsultasi');
$update = $this->M_konsultasi->updatedAt($updateat, $id_konsultasi);
$save = $this->M_konsultasi->sendReply($reply, $id_konsultasi);
redirect('dashboard/detail/' . $id);
}
}
示例4: generateNavigator
protected function generateNavigator()
{
$role = sentinel()->getUser()->roles->pluck('slug')->toArray();
$menus = $this->getMenusByRole($role);
$template = $this->load->view('template/menus', compact('menus'), TRUE);
$this->template->set('navigator', $template);
return $template;
}
示例5: pengampu
public function pengampu()
{
$data['users'] = sentinel()->findRoleBySlug('ta')->users->pluck('email', 'id')->toArray();
$data['getKategori'] = $this->model->getAllGroupByUser();
// $data['getUser'] = $this->model->getByUser();
$data['kategori_list'] = $this->model->getKategoriList();
$this->template->build('pengampu', $data);
}
示例6: __construct
public function __construct()
{
$this->user = sentinel()->getUser();
$this->course = new Course();
$this->category = new Category();
$this->chapter = new Chapter();
$this->attachment = new Attachment();
}
示例7: __construct
public function __construct()
{
$this->model = new Model\Portal\Article();
$this->imageManager = new ImageManager();
$this->user = sentinel()->check();
$this->categories = [];
$this->tags = [];
}
示例8: check
public function check()
{
if (!sentinel()->check()) {
redirect(login_url(), 'refresh');
}
if (!sentinel()->inRole($this->roles)) {
redirect(site_url(), 'refresh');
}
}
示例9: onlyAllowEditor
public function onlyAllowEditor()
{
if (sentinel()->inRole('edt')) {
$user = sentinel()->getUser();
$allowed_ids = $user->editorcategory->pluck('id')->toArray();
$this->db->group_start()->where_in('id', $allowed_ids)->or_where_in('parent', $allowed_ids)->group_end();
}
return $this;
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model(array('Model_faq' => 'model_faq'));
if (!sentinel()->check()) {
redirect(login_url());
}
}
示例11: index
public function index()
{
if (sentinel()->inRole('ins')) {
redirect('dashboard', 'refresh');
return;
}
$popular = $this->repository->getPopular()->take(4);
$latest = $this->repository->getLatest()->take(8);
$this->template->build('index', compact('popular', 'latest'));
}
示例12: check
public function check()
{
if (!sentinel()->check()) {
redirect(login_url(), 'refresh');
}
if (!sentinel()->inRole($this->roles)) {
set_message_error('Anda tidak mempunyai hak akses.');
redirect(login_url(), 'refresh');
}
}
示例13: run
/**
* Run Method.
*
* Write your database seeder using this method.
*
* More information on writing seeders is available here:
* http://docs.phinx.org/en/latest/seeding.html
*/
public function run()
{
$this->execute('DELETE FROM role_users');
$role = sentinel()->getRoleRepository()->createModel();
$role->truncate();
$roles = ['su' => 'Super Admin', 'adm' => 'Admin', 'edt' => 'Editor', 'ctr' => 'Contributor', 'ins' => 'Instructor', 'lnr' => 'Learner', 'pcp' => 'Principal', 'mdr' => 'Moderator', 'ast' => 'Asisten', 'pus' => 'Pustakawan', 'ta' => 'Tenaga Ahli'];
foreach ($roles as $slug => $name) {
$role->create(compact('slug', 'name'));
}
}
示例14: setUser
public function setUser($user)
{
if ($user instanceof User) {
$this->user = $user;
} elseif (is_numeric($user)) {
$this->user = User::findOrFail($user);
} else {
$this->user = sentinel()->getUser();
}
return $this;
}
示例15: show
public function show($category, $id, $name)
{
$this->medialib = new Library\Media\Media();
$modelMedia = new Library\Media\Model\Media();
$user = sentinel()->getUser();
$name = urldecode($name);
$media = $this->medialib->getMedia()->where('file_name', 'like', $name . '%')->findOrFail($id);
$data = ['category' => $media->category, 'media' => $media];
$modelMedia->resolveVisitorUnique($user, $media->id);
$this->template->build('single', $data);
}