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


PHP Entrust::user方法代码示例

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


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

示例1: postSchimbaStadiu

 public function postSchimbaStadiu($id_livrabil)
 {
     $actualizare_ore = Input::get('ore_lucrate') > 0;
     $is_stadiu = Input::get('stadiu_selectionat') != null && Input::get('stadiu_selectionat') > 0;
     $array_update = array();
     if ($is_stadiu) {
         //Face insert in tabela de istoric de stadii
         //Actualizeaza stadiul livrabilului
         $array_update = array_add($array_update, 'id_stadiu', Input::get('stadiu_selectionat'));
     }
     if ($actualizare_ore) {
         //Actualizeaza numarul de ore lucrate la acest livrabil
         $array_update = array_add($array_update, 'ore_lucrate', Input::get('ore_lucrate'));
     }
     // Start transaction!
     DB::beginTransaction();
     if ($is_stadiu) {
         try {
             DB::table('istoric_stadii_livrabil')->insertGetId(array('id_livrabil_etapa' => Input::get('id_livrabil_etapa'), 'id_stadiu' => Input::get('stadiu_selectionat'), 'id_user' => Entrust::user()->id));
         } catch (Exception $e) {
             DB::rollback();
             return Redirect::back()->with('message', 'Eroare salvare date: ' . $e);
         }
     }
     if ($is_stadiu || $actualizare_ore) {
         try {
             DB::table('livrabile_etapa')->where('id', Input::get('id_livrabil_etapa'))->update($array_update);
         } catch (Exception $e) {
             DB::rollback();
             return Redirect::back()->with('message', 'Eroare salvare date: ' . $e);
         }
     }
     DB::commit();
     return Redirect::back()->with('message', 'Actualizare realizata cu succes!')->withInput();
 }
开发者ID:binaryk,项目名称:lareab,代码行数:35,代码来源:StadiuLivrabilController.php

示例2: getOrganizations

 public function getOrganizations()
 {
     //creare filtru bazat pe calitatea utilizatorului
     $sql_filter = '';
     //filtru sql gol
     if (!Entrust::can('administrare_platforma')) {
         $sql_filter = ' AND id = ' . Entrust::user()->id_org . ' ';
         //adaugam filtru
     }
     //sfarsit creare filtru
     $sql = "SELECT \n\t\tid,\n\t\tname\n\t\tFROM \n\t\torganizations\n\t\tWHERE\n\t\tlogical_delete = 0\n\t\tAND id > 0\n\t\t" . $sql_filter . "\n\t\tORDER BY\n\t\tname";
     $organizations = DB::select($sql);
     return $organizations;
 }
开发者ID:binaryk,项目名称:lareab,代码行数:14,代码来源:AdminDepartamenteController.php

示例3: 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

示例4: validateAndSave

 public function validateAndSave($post)
 {
     // create the validator
     $validator = Validator::make(Input::all(), Post::$rules);
     // attempt validation
     if ($validator->fails()) {
         Session::flash('errorMessage', 'Ohh no! Something went wrong...You should be seeing some errors down below...');
         Log::info('Validator failed', Input::all());
         // validation failed, redirect to the post create page with validation errors and old inputs
         return Redirect::back()->withInput()->withErrors($validator);
     } else {
         if (Input::hasFile('image')) {
             $file = Input::file('image');
             $post->uploadImage($file);
         }
         $post->title = Input::get('title');
         $post->body = Input::get('body');
         $post->user_id = Auth::id();
         $post->save();
         if (Entrust::hasRole('guest')) {
             $guest = Role::where('name', 'guest')->firstOrFail();
             Entrust::user()->detachRole($guest);
         }
         if (Request::wantsJson()) {
             return Response::json(array('Status' => 'Request Succeeded'));
         } else {
             Session::flash('successMessage', 'Your post has been successfully saved.');
             return Redirect::action('PostsController@show', array($post->id));
         }
     }
 }
开发者ID:BobFromAccounting,项目名称:laravel_blog,代码行数:31,代码来源:PostsController.php


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