本文整理汇总了PHP中Entrust类的典型用法代码示例。如果您正苦于以下问题:PHP Entrust类的具体用法?PHP Entrust怎么用?PHP Entrust使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Entrust类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: isAdmin
public static function isAdmin()
{
if (!Entrust::hasRole('admin')) {
return false;
}
return true;
}
开发者ID:christiannwamba,项目名称:laravel-site,代码行数:7,代码来源:helper.php
示例2: index
/**
* Display a listing of rateinquiries
*
* @return Response
*/
public function index()
{
//RateInquiry::where('viewed', 0)->where('status', 1)->update(array('viewed'=> 1));
$from = null;
$to = null;
if (Input::has('search')) {
//dd(Input::all());
$from = Input::get('from');
$to = Input::get('to');
if (Entrust::hasRole('Admin')) {
$user_id = Input::get('agent_id');
$rateinquiries = RateInquiry::whereHas('user', function ($q) use($user_id) {
$q->where('users.id', 'like', '%' . $user_id . '%');
});
} elseif (Entrust::hasRole('Agent')) {
$rateinquiries = RateInquiry::whereHas('user', function ($q) {
$q->where('users.id', '=', Auth::id());
});
}
if (!empty($from) && !empty($to)) {
$rateinquiries = $rateinquiries->where('from', '>=', $from)->where('to', '<=', $to);
}
$rateinquiries = $rateinquiries->get();
} else {
if (Entrust::hasRole('Admin')) {
$rateinquiries = RateInquiry::orderBy('updated_at', 'desc')->get();
} elseif (Entrust::hasRole('Agent')) {
$rateinquiries = RateInquiry::where('user_id', Auth::id())->orderBy('updated_at', 'desc')->get();
}
}
return View::make('inquiries.rate-inquiries.index', compact('rateinquiries', 'user_id', 'from', 'to'));
}
开发者ID:tharindarodrigo,项目名称:agent,代码行数:37,代码来源:RateInquiriesController.php
示例3: 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
示例4: 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
示例5: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next, $role)
{
if (\Auth::check() && !\Entrust::hasRole($role)) {
return redirect()->back();
}
return $next($request);
}
开发者ID:alkzzz,项目名称:mycms,代码行数:14,代码来源:RoleMiddleware.php
示例6: getCreditLimit
public static function getCreditLimit($agent_id)
{
if (Entrust::hasRole('Agent')) {
return Agent::where('user_id', $agent_id)->first()->credit_limit;
}
return false;
}
开发者ID:tharindarodrigo,项目名称:agent,代码行数:7,代码来源:Agent.php
示例7: __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
示例8: __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
示例9: userHasAgent
public static function userHasAgent()
{
if (Entrust::hasRole('Agent')) {
if ($x = User::getAgentOfUser(Auth::user())) {
return Agent::with('market')->find($x->agent_id);
}
}
return false;
}
开发者ID:tharindarodrigo,项目名称:agent,代码行数:9,代码来源:User.php
示例10: 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
示例11: 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
示例12: __construct
public function __construct()
{
$this->_user = Auth::user();
$this->_parameters = Route::current()->parameters();
if (!User::hasHotelPermission($this->_user, $this->_parameters['hotels'])) {
if (!Entrust::hasRole('Admin')) {
App::abort(403);
}
}
}
开发者ID:tharindarodrigo,项目名称:agent,代码行数:10,代码来源:SupplementRatesController.php
示例13: 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
示例14: destroy
public function destroy(Comment $comment)
{
if ($comment->user_id != Auth::user()->id && !Entrust::hasRole('admin')) {
return redirect()->back()->withErrors(config('constants.INVALID_LINK'));
}
$belongs_to = $comment->belongs_to;
$comment->delete();
$activity = 'Deleted a commented on a ' . ucfirst($belongs_to);
Activity::log($activity);
return redirect()->back()->withSuccess(config('constants.DELETED'));
}
开发者ID:EneaWeb,项目名称:aliangel,代码行数:11,代码来源:CommentController.php
示例15: getInDebugModeAttribute
public function getInDebugModeAttribute()
{
//限管理員
if (!\Entrust::hasRole('admin')) {
return false;
}
if (!$this->debug) {
return false;
}
return true;
}
开发者ID:alhs1995,项目名称:DBFP,代码行数:11,代码来源:User.php
示例16: postDestroy
public function postDestroy($id)
{
if (\Entrust::hasRole('Admin')) {
$category = Category::find($id);
if ($category) {
$category->delete();
return redirect('admin/categories/view')->with('flash_message', 'Category deleted');
}
}
return redirect('admin/categories/view')->with('flash_message', 'You unable to delete categories due to Demo account');
}
开发者ID:alongmuaz,项目名称:laravel-fyp-cart,代码行数:11,代码来源:CategoryController.php
示例17: login
/**
* Login with the provided username & password in local first, if
* failed, try login in center.
*
* @param Request
* @return Json
*/
public function login(Request $request)
{
$username = $request->input('username');
$password = $request->input('password');
// if login failed
if (!Auth::attempt(['username' => $username, 'password' => $password]) && self::loginCheckSSO($username, $password) === 'SUCCESS') {
$user = User::where('username', '=', $username)->first();
Auth::login($user);
}
$response = ['is_student' => \Entrust::hasRole('student'), 'is_manager' => \Entrust::hasRole('manager'), 'status' => Auth::check()];
return response()->json($response);
}
开发者ID:AbsolutePowerEvolution,项目名称:VersatilitySystem,代码行数:19,代码来源:AuthController.php
示例18: 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
示例19: 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
示例20: 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
注:本文中的Entrust类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论