当前位置: 首页>>代码示例>>PHP>>正文


PHP Entrust::can方法代码示例

本文整理汇总了PHP中Entrust::can方法的典型用法代码示例。如果您正苦于以下问题:PHP Entrust::can方法的具体用法?PHP Entrust::can怎么用?PHP Entrust::can使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entrust的用法示例。


在下文中一共展示了Entrust::can方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: allowed

 public function allowed($sAction = null, $sRole = null)
 {
     if (static::isAdmin() || \Entrust::hasRole('admin') || \Entrust::can($sAction) || \Entrust::hasRole($sRole)) {
         return true;
     }
     return false;
 }
开发者ID:laravel-blog,项目名称:laravel51-sandbox,代码行数:7,代码来源:Helper.php

示例2: __construct

 public function __construct()
 {
     $this->data['crud'] = $this->crud;
     // Check for the right roles to access these pages
     if (!\Entrust::can('view-admin-panel')) {
         abort(403, trans('crud.unauthorized_access'));
     }
 }
开发者ID:hramose,项目名称:crud,代码行数:8,代码来源:CrudController.php

示例3: __construct

 public function __construct()
 {
     $this->middleware('auth');
     // Check for the right roles to access these pages
     if (!\Entrust::can('view-admin-panel')) {
         abort(403, 'Unauthorized access - you do not have the necessary role to see this page.');
     }
 }
开发者ID:tahirghori,项目名称:dick,代码行数:8,代码来源:AdminController.php

示例4: inicio

 public function inicio(Request $request)
 {
     if (!\Entrust::can('crud-promociones')) {
         return \Redirect::to('/');
     } else {
         $registros = Promociones::buscar($request->get('parametros'))->orderBy('nombre', 'desc')->paginate(6);
         return view('Center.promociones.ver')->with('registros', $registros);
     }
 }
开发者ID:JFSolorzano,项目名称:Acordes,代码行数:9,代码来源:PromocionesCtrl.php

示例5: inicio

 /**
  * Funcion que retorna la vista de inicio del modulo de Equipo, esta retorna la vista con los datos
  * @param Request $request - variable interna que controla los elementos de la vista para obtner su valor
  * @return $this
  */
 public function inicio(Request $request)
 {
     if (!\Entrust::can('crud-empleados')) {
         return \Redirect::to('/');
     } else {
         $registros = \DB::table('users')->join('role_user', 'users.id', '=', 'user_id')->join('roles', 'roles.id', '=', 'role_id')->where('users.type', '=', 0)->select('users.id AS id_usuario', 'users.name AS nombre_usuario', 'users.email', 'users.avatar', 'roles.display_name')->orderBy('roles.display_name', 'asc')->paginate(6);
         return view('Center.empleados.ver')->with('registros', $registros);
     }
 }
开发者ID:JFSolorzano,项目名称:Acordes,代码行数:14,代码来源:EmpleadosCtrl.php

示例6: index

 /**
  * Display a listing of xcasts
  *
  * @return Response
  */
 public function index()
 {
     $search = Request::get('q');
     $xcasts = $search ? Xcast::search($search) : Xcast::latest('updated_at');
     if (!Entrust::can('manage_premium_casts') && !Entrust::can('delete_casts')) {
         $xcasts = $xcasts->onlyFree();
     }
     $xcasts = $xcasts->paginate(8);
     return View::make('admin.xcasts.index', compact('xcasts'));
 }
开发者ID:xfyuan,项目名称:xemecasts,代码行数:15,代码来源:XcastsController.php

示例7: getReprezentantiOrganizatie

 public function getReprezentantiOrganizatie()
 {
     $reprezentanti = array();
     $sql = "SELECT \n            rl.id,\n            rl.nume,\n            rl.cnp\n            FROM reprezentant_legal rl\n            WHERE rl.logical_delete = 0";
     if (\Entrust::can('administrare_platforma')) {
         $reprezentanti = DB::select($sql);
     } else {
         $sql .= " AND id_organizatie = :id_organizatie";
         $reprezentanti = DB::select($sql, array('id_organizatie' => isset(self::organizatie()[0]) ? self::organizatie()[0]->id_organizatie : -1));
     }
     return View::make('entitate::reprezentant_legal.list')->with('reprezentanti', $reprezentanti);
 }
开发者ID:binaryk,项目名称:lareab,代码行数:12,代码来源:ReprezentantLegalController.php

示例8: getBanci

 public function getBanci()
 {
     $banci = array();
     $sql = "SELECT\n            id,\n            denumire,\n            adresa,     \n            telefon\n            FROM banca\n            WHERE logical_delete = 0";
     if (\Entrust::can('administrare_platforma')) {
         $banci = DB::select($sql);
     } else {
         $sql .= " AND id_organizatie = :id_organizatie";
         $banci = DB::select($sql, array('id_organizatie' => isset(self::organizatie()[0]) ? self::organizatie()[0]->id_organizatie : -1));
     }
     return View::make("banca::banca.list")->with("banci", $banci);
 }
开发者ID:binaryk,项目名称:lareab,代码行数:12,代码来源:BancaController.php

示例9: getInvestitii

 public function getInvestitii()
 {
     $ids = self::getIDsDepartamente(Confide::getDepartamenteUser());
     $sql = "SELECT \n            investitie.id,\n            investitie.denumire,\n            im.adresa,\n            investitie.id_imobil,\n            j.denumire AS judet,\n            l.denumire AS localitate\n            FROM por12_investitie investitie\n            INNER JOIN imobil im ON im.id = investitie.id_imobil AND im.logical_delete = 0\n            LEFT OUTER JOIN judet j ON j.id_judet = im.id_judet AND j.logical_delete = 0\n            LEFT OUTER JOIN localitate l ON l.id_localitate = im.id_localitate AND l.logical_delete = 0";
     if (!Entrust::can("administrare_platforma")) {
         $sql .= " INNER JOIN departament ON departament.id = investitie.id_departament AND departament.logical_delete = 0\n                    AND departament.id IN (" . $ids . ") ";
     }
     $sql .= " WHERE investitie.logical_delete = 0";
     //dd($sql);
     $investitii = DB::select($sql);
     return View::make('investitie_por_axa12.list')->with('investitii', $investitii);
 }
开发者ID:binaryk,项目名称:lareab,代码行数:12,代码来源:InvestitiePORAxa12Controller.php

示例10: delete

 /**
  * Deletes a backup file.
  */
 public function delete($file_name)
 {
     if (!\Entrust::can('delete-backups')) {
         abort(403, 'Unauthorized access - you do not have the necessary permission to delete backups.');
     }
     $disk = Storage::disk(config('dick.backupmanager.disk'));
     if ($disk->exists('backups/' . $file_name)) {
         $disk->delete('backups/' . $file_name);
         return 'success';
     } else {
         abort(404, "The backup file doesn't exist.");
     }
 }
开发者ID:catchup-forks,项目名称:backupmanager,代码行数:16,代码来源:BackupController.php

示例11: delete

 /**
  * Deletes a log file.
  */
 public function delete($file_name)
 {
     if (!\Entrust::can('delete-logs')) {
         abort(403, 'Unauthorized access - you do not have the necessary permission to delete logs.');
     }
     $disk = Storage::disk('local');
     if ($disk->exists('logs/' . $file_name)) {
         $disk->delete('logs/' . $file_name);
         return 'success';
     } else {
         abort(404, "The log file doesn't exist.");
     }
 }
开发者ID:catchup-forks,项目名称:logmanager,代码行数:16,代码来源:LogController.php

示例12: getPersonalOrganizatie

 public function getPersonalOrganizatie()
 {
     $personal = array();
     $sql = "SELECT \n            p.id,\n            p.nume,\n            p.cnp,\n            p.telefon_1,\n            p.telefon_2,\n            p.mail_1,\n            p.mail_2,\n            (SELECT group_concat(ent.denumire) \n                FROM entitate ent\n                INNER JOIN personal_entitate pe ON pe.id_entitate = ent.id AND pe.logical_delete = 0\n                WHERE ent.logical_delete = 0\n                AND pe.id_personal = p.id) AS entitati\n            FROM personal p\n            WHERE p.logical_delete = 0";
     //dd($sql);
     if (\Entrust::can('administrare_platforma')) {
         $personal = DB::select($sql);
     } else {
         $sql .= " AND p.id_organizatie = :id_organizatie";
         $personal = DB::select($sql, array('id_organizatie' => isset(self::organizatie()[0]) ? self::organizatie()[0]->id_organizatie : -1));
         //dd($sql);
     }
     return View::make('entitate::personal.list')->with('personal', $personal);
 }
开发者ID:binaryk,项目名称:lareab,代码行数:14,代码来源:PersonalEntitateController.php

示例13: getSeriiFacturare

 public function getSeriiFacturare()
 {
     $ids = self::getIDsDepartamente(Confide::getDepartamenteUser());
     $sql = "SELECT \n          sf.id,\n          sf.serie,\n          sf.numar,\n          sf.id_entitate,\n          ent.denumire AS entitate\n          FROM serie_factura sf\n          INNER JOIN entitate ent ON ent.id = sf.id_entitate AND ent.logical_delete = 0\n          WHERE ";
     if (!Entrust::can("administrare_platforma")) {
         /*$sql .= 
           " INNER JOIN departament d ON d.id_entitate = ent.id AND d.logical_delete = 0" .
           " AND d.id IN (" . $ids . ")";*/
         $sql .= " EXISTS(SELECT id FROM departament WHERE departament.id_entitate = sf.id_entitate AND departament.logical_delete = 0\n                    AND departament.id IN (" . $ids . ")) AND ";
     }
     $sql .= " sf.logical_delete = 0 ORDER BY ent.id, sf.serie";
     //dd($sql);
     $serii = DB::select($sql);
     return View::make('serii_facturare.list')->with('serii', $serii);
 }
开发者ID:binaryk,项目名称:lareab,代码行数:15,代码来源:SerieFacturareController.php

示例14: getAll

 /**
  * @param       $filters
  * @param  null $limit
  *
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function getAll($filters, $limit = null)
 {
     $query = $this->post->select('*');
     if (!\Entrust::can('manage-all-content')) {
         $query->where('created_by', auth()->user()->id);
     }
     $from = "posts ";
     if (isset($filters['status']) && $filters['status'] != '') {
         $status = $filters['status'];
         $query->whereRaw("posts.metadata->>'status' = ?", [$status]);
     }
     if (isset($filters['date_from']) && $filters['date_from'] != '') {
         $query->whereRaw("date(created_at) >= ?", [str_replace('/', '-', $filters['date_from'])]);
     }
     if (isset($filters['date_to']) && $filters['date_to'] != '') {
         $query->whereRaw("date(created_at) <= ?", [str_replace('/', '-', $filters['date_to'])]);
     }
     if (isset($filters['post_type']) && $filters['post_type'] != '') {
         $post_type = $filters['post_type'];
         $query->whereRaw("posts.metadata->>'type' = ?", [$post_type]);
     }
     if (array_has($filters, "sub_category1")) {
         $ids = $filters['sub_category1'];
         $query->category($ids);
     }
     if (array_has($filters, "sub_category")) {
         $category = Category::find($filters['sub_category']);
         $category_ids = $category->getDescendantsAndSelf()->lists('id')->toArray();
         $query->category($category_ids);
     }
     if (array_has($filters, "category")) {
         $category = Category::find($filters['category']);
         $category_ids = $category->getDescendantsAndSelf()->lists('id')->toArray();
         $query->category($category_ids);
     }
     $query->from($this->db->raw($from));
     $query->orderBy('updated_at', 'DESC');
     if (is_null($limit)) {
         return $query->get();
     }
     return $query->paginate();
 }
开发者ID:Shuvayatra,项目名称:migration-web,代码行数:48,代码来源:PostRepository.php

示例15: getEntitati

 public function getEntitati($tip_entitate)
 {
     $sql = "SELECT \n            ent.id, \n            ent.denumire, \n            ent.cif,\n            ent.adresa, \n            ent.cod_postal, \n            ent.telefon, \n            ent.fax, \n            ent.id_organizatie, \n            ent.id_tip_entitate,             \n            judet.denumire AS judet, \n            loc.denumire AS localitate\n            FROM entitate ent\n            LEFT OUTER JOIN judet ON ent.id_judet = judet.id_judet AND judet.logical_delete = 0 \n            LEFT OUTER JOIN localitate loc ON ent.id_localitate = loc.id_localitate AND loc.logical_delete = 0";
     $and = "";
     if (\Entrust::hasRole("Administrator de grup")) {
         $and = " AND ent.id_organizatie = " . \Entrust::user()->id_org;
     } else {
         if (!\Entrust::can("administrare_platforma")) {
             $ids = self::getIDsDepartamente(\Confide::getDepartamenteUser());
             $sql = $sql . " INNER JOIN departament d ON d.id_entitate = ent.id AND d.logical_delete = 0" . " AND d.id IN (" . $ids . ")";
         }
     }
     $sql .= " WHERE ent.logical_delete = 0 ";
     $sql .= $and;
     if ($tip_entitate == 1) {
         $sql .= " AND ent.id_tip_entitate = 1 ";
     } else {
         $sql .= " AND ent.id_tip_entitate = 2 ";
     }
     $sql .= " GROUP BY ent.id";
     $entitati = DB::select($sql);
     //dd($sql);
     return View::make('entitate::entitati_organizatie.list')->with('entitati', $entitati)->with('tip_entitate', $tip_entitate);
 }
开发者ID:binaryk,项目名称:lareab,代码行数:24,代码来源:EntitatiOrganizatieController.php


注:本文中的Entrust::can方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。