本文整理汇总了PHP中Helpers::hasAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::hasAccess方法的具体用法?PHP Helpers::hasAccess怎么用?PHP Helpers::hasAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helpers
的用法示例。
在下文中一共展示了Helpers::hasAccess方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Displays a grid of titles with pagination.
*
* @return View
*/
public function index()
{
$input = Input::all();
$data = $this->title->titleIndex($input, 'movie');
if (isset($input['genre'])) {
$genre = $input['genre'];
$data = $data->genres($data, $genre);
} else {
$genre = 'all';
}
if (isset($input['relevance'])) {
$relevance = $input['relevance'];
$data = $data->relevance($data, $relevance);
} else {
$relevance = 'all';
}
if (isset($input['yearFrom'])) {
$yearFrom = $input['yearFrom'];
} else {
$yearFrom = Title::getYearOldest();
}
if (isset($input['yearTo'])) {
$yearTo = $input['yearTo'];
} else {
$yearTo = Title::getYearNewest();
}
$data = $data->yearsRange($data, $yearFrom, $yearTo);
$yearFrom = Title::getYearOldest();
$yearTo = Title::getYearNewest();
if (isset($input['view'])) {
if ($input['view'] > 1 || $input['view'] < 0) {
$view = 0;
} else {
$view = $input['view'];
}
} else {
$view = 0;
}
// Get only online movies
if (!Helpers::hasAccess('titles.create')) {
$data = $data->online($data);
}
if (isset($input['numRows'])) {
$numRows = $input['numRows'];
} else {
$numRows = 18;
}
if (isset($input['sortBy'])) {
$sortBy = Title::sortByString($input['sortBy']);
} else {
$sortBy = Title::sortByString('lastAdded');
}
$data = $data->orderBy($sortBy['field'], $sortBy['direction'])->paginate($numRows);
if (isset($input['sortBy'])) {
$sortBy = $input['sortBy'];
} else {
$sortBy = 'lastAdded';
}
return View::make('titles.index')->withData($data)->withView($view)->withGenre($genre)->withRelevance($relevance)->withYearfrom($yearFrom)->withYearto($yearTo)->withNumrows($numRows)->withSortby($sortBy);
}
示例2: getYearNewest
/**
* Get the year of the newest movie.
*
* @param Illuminate\Database\Eloquent\Builder $query
* @return string
*/
public static function getYearNewest()
{
if (Helpers::hasAccess('titles.create')) {
$year = Title::max('year');
} else {
$year = Title::where('type', '=', 'movie')->whereNotNull('video')->where('video', '<>', '')->whereNotNull('poster')->where('poster', '<>', '')->whereNotNull('background')->where('background', '<>', '')->max('year');
}
return $year;
}
示例3: detach
/**
* Detach link from specified title.
*
* @return Response
*/
public function detach()
{
$input = Input::except('_token');
if (!isset($input['title_id'])) {
return Response::json(trans('dash.somethingWrong'), 500);
}
$link = $this->model->where('url', $input['url'])->where('title_id', $input['title_id'])->first();
if ($link && (!(int) $link->approved || Helpers::hasAccess('super'))) {
$link->delete();
}
return Response::json(trans('stream::main.detachSuccess'), 200);
}
示例4: __construct
public function __construct(Search $search, SearchAdmin $searchAdmin, Auto $autocomplete, Cacher $cache)
{
$this->beforeFilter('csrf', array('on' => 'post'));
$this->cache = $cache;
$this->autocomplete = $autocomplete;
//get search provider name for differianting between
//different providers query caches
$this->options = App::make('Options');
if (Helpers::hasAccess('super')) {
$this->search = $searchAdmin;
$this->provider = $this->options->getSearchProvider();
} else {
$this->search = $search;
$this->provider = 'db';
}
}
示例5: array
<?php
return array('uri' => 'dashboard', 'title' => trans('main.dashboard'), 'model_config_path' => app('path') . '/config/administrator', 'settings_config_path' => app('path') . '/config/administrator/settings', 'menu' => array('Movies & Series' => array('movies', 'series'), 'actors', 'directors', 'writers', 'users', 'groups', 'news', 'Settings' => array('settings.options', 'settings.backgrounds', 'settings.appearance', 'settings.ads')), 'permission' => function () {
return Helpers::hasAccess('super');
}, 'use_dashboard' => true, 'dashboard_view' => 'dashboard.master', 'home_page' => 'settings.options', 'login_path' => 'login', 'logout_path' => 'logout', 'login_redirect_key' => 'redirect', 'global_rows_per_page' => 20, 'locales' => array());
示例6: public_path
<?php
Lang::addNamespace('stream', public_path('plugins/streaming/plugin/lang'));
//register plugin routes
require public_path() . '/plugins/streaming/plugin/routes.php';
//register a filter for links
Route::filter('links', function ($route, $request, $value) {
if (!is_string($value)) {
App::Abort(403);
}
if (!Helpers::hasAccess("links.{$value}")) {
return Redirect::to('/');
}
});
//make sure laravel can find and load plugin views
View::addLocation(public_path('plugins/streaming/plugin/views'));
//override mtdb controllers
App::bind('DashboardController', function () {
return new StreamingDashboardController();
});
App::bind('SeriesSeasonsController', function () {
return new StreamingSeriesSeasonsController();
});
App::bind('SeasonsEpisodesController', function () {
return new StreamingSeasonsEpisodesController();
});
//override other classes
App::bind('Lib\\Repository', function () {
return new Plugins\Streaming\Plugin\Lib\Repository();
});
App::bind('Lib\\Titles\\TitleRepository', function () {
示例7: function
Route::filter('people', function ($route, $request, $value) {
if (!is_string($value)) {
App::Abort(403);
}
if (!Helpers::hasAccess("people.{$value}")) {
return Redirect::to('people');
}
});
Route::filter('logged', function () {
if (!Helpers::loggedInUser()) {
Session::put('url.intended', Request::url());
return Redirect::to('login');
}
});
//if we have options table and installed is
//set to trudy value we'll bail with 404
Route::filter('installed', function () {
if (Schema::hasTable('options')) {
$installed = DB::table('options')->where('name', 'installed')->first();
if ($installed || $installed['value']) {
App::abort(404, 'page not found');
}
}
});
//if we have options table and installed is
//set to trudy value we'll bail with 404
Route::filter('updated', function () {
if (!Helpers::hasAccess('super')) {
App::abort(404);
}
});