本文整理汇总了PHP中handles函数的典型用法代码示例。如果您正苦于以下问题:PHP handles函数的具体用法?PHP handles怎么用?PHP handles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了handles函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
*
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect(handles('app::home'));
}
return $next($request);
}
示例2: filter
/**
* Run the request filter.
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
* @param string $value
*
* @return mixed
*/
public function filter(Route $route, Request $request, $value = '')
{
list($action, $type) = explode('-', $value);
if (!$this->checkUserAuthorization($action, $type)) {
return redirect(handles("orchestra::media/{$type}s"));
}
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect(handles('app::home'));
}
return $next($request);
}
示例4: setupFilters
protected function setupFilters()
{
$this->beforeFilter('orchestra.csrf', ['only' => ['update', 'store']]);
$this->beforeFilter(function () {
if (Auth::guest()) {
return Redirect::to(handles('orchestra::/'));
}
});
}
示例5: table
/**
* Table View Generator for Orchestra\Resources.
*
* @param array $model
*
* @return \Orchestra\Contracts\Html\Table\Builder
*/
public function table($model)
{
return $this->table->of('orchestra.resources: list', function (TableGrid $table) use($model) {
$table->with($model, false);
$table->layout('orchestra/foundation::components.table');
$table->column('name')->escape(false)->value(function ($row) {
$link = app('html')->link(handles("orchestra::resources/{$row->id}"), e($row->name));
return app('html')->create('strong', app('html')->raw($link));
});
});
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
*
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest(handles('orchestra::login'));
}
}
return $next($request);
}
示例7: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest(handles('orchestra::login'));
}
}
return $next($request);
}
示例8: actions
/**
* Table actions View Generator for Orchestra\Model\User.
*
* @param \Orchestra\Contracts\Html\Table\Builder $table
*
* @return \Orchestra\Contracts\Html\Table\Builder
*/
public function actions(TableBuilder $table)
{
return $table->extend(function (TableGrid $table) {
$table->column('action')->label('Action')->escape(false)->attributes(function () {
return ['class' => 'th-action'];
})->value(function ($row) {
$html = [app('html')->link(handles("orchestra::media/profile/{$row->id}/edit"), trans('orchestra/foundation::label.edit'), ['class' => 'btn btn-xs btn-warning'])];
$roles = [(int) $this->config->get('orchestra/foundation::media.admin'), (int) $this->config->get('orchestra/foundation::media.member')];
if (!in_array((int) $row->id, $roles)) {
$html[] = app('html')->link(handles("orchestra::media/profile/{$row->id}/delete", ['csrf' => true]), trans('orchestra/foundation::label.delete'), ['class' => 'btn btn-xs btn-danger']);
}
return app('html')->create('div', app('html')->raw(implode('', $html)), ['class' => 'btn-group']);
});
});
}
示例9: permalink
/**
* Generate URL by content.
*
* @param string $type
* @param \Orchestra\Story\Model\Content|null $content
*
* @return string
*/
public function permalink($type, $content = null)
{
$format = $this->app['config']->get("orchestra/story::permalink.{$type}");
if (is_null($format) || !$content instanceof Content) {
return handles('orchestra/story::/');
}
if (is_null($published = $content->getAttribute('published_at'))) {
$published = Carbon::now();
}
$permalinks = ['id' => $content->getAttribute('id'), 'slug' => str_replace(['_post_/', '_page_/'], '', $content->getAttribute('slug')), 'type' => $content->getAttribute('type'), 'date' => $published->format('Y-m-d'), 'year' => $published->format('Y'), 'month' => $published->format('m'), 'day' => $published->format('d')];
foreach ($permalinks as $key => $value) {
$format = str_replace('{' . $key . '}', $value, $format);
}
return handles("orchestra/story::{$format}");
}
示例10: configure
/**
* Form View Generator for Orchestra\Extension.
*
* @param \Illuminate\Support\Fluent $model
* @param string $name
*
* @return \Orchestra\Contracts\Html\Form\Builder
*/
public function configure($model, $name)
{
return $this->form->of("orchestra.extension: {$name}", function (FormGrid $form) use($model, $name) {
$form->setup($this, "orchestra::extensions/{$name}/configure", $model);
$handles = data_get($model, 'handles', $this->extension->option($name, 'handles'));
$configurable = data_get($model, 'configurable', true);
$form->fieldset(function (Fieldset $fieldset) use($handles, $name, $configurable) {
// We should only cater for custom URL handles for a route.
if (!is_null($handles) && $configurable !== false) {
$fieldset->control('input:text', 'handles')->label(trans('orchestra/foundation::label.extensions.handles'))->value($handles);
}
$fieldset->control('input:text', 'migrate')->label(trans('orchestra/foundation::label.extensions.update'))->field(function () use($name) {
return app('html')->link(handles("orchestra::extensions/{$name}/update", ['csrf' => true]), trans('orchestra/foundation::label.extensions.actions.update'), ['class' => 'btn btn-info']);
});
});
});
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(CoursesRequest $request)
{
try {
$file = Input::file('file1');
$filename1 = 'courses_' . uniqid() . '.jpg';
$destinationPath = 'images/courses';
$itemImage = Image::make($file)->fit(350, 450);
$itemImage->save($destinationPath . '/' . $filename1);
$request['photo'] = $destinationPath . '/' . $filename1;
$courses = Courses::create($request->all());
} catch (Exception $e) {
Flash::error('Unable to Save');
return $this->redirect(handles('bluschool/courses::courses'));
}
Flash::success($courses->name . ' Saved Successfully');
return $this->redirect(handles('bluschool/courses::member'));
}
示例12: update
/**
* Update the role.
* @return mixed
*/
public function update($reporterId, Request $request)
{
$reporter = MediaReporter::find($reporterId);
if ($reporter->status == 0) {
foreach ($request->zone as $key => $zone) {
$reporter->zone()->create(['zone' => $zone]);
}
$reporter->status = 1;
$reporter->save();
} else {
if ($reporter->status == 1) {
$massage = "Already Approve";
} else {
$massage = "Reporter Not Found";
}
Flash::error($massage);
return $this->redirect(handles('blupl/printmedia::approval'));
}
Flash::success($reporter->name . ' Approved Successfully');
return $this->redirect(handles('blupl/printmedia::approval'));
}
示例13: update
/**
* Update the role.
* @return mixed
*/
public function update($franchise, $cateegory, $id, Request $request)
{
$item = Franchise::find($franchise)->{$cateegory}->find($id);
// dd($item);
if ($item->status == 0) {
foreach ($request->zone as $zone) {
$item->zone()->create(['zone' => $zone]);
}
$item->status = 1;
$item->save();
} else {
if ($item->status == 1) {
$massage = "Already Approve";
} else {
$massage = "Reporter Not Found";
}
Flash::error($massage);
return $this->redirect(handles('blupl/franchise::approval/franchise/' . $franchise . '/' . $cateegory));
}
Flash::success($item->name . ' Approved Successfully');
return $this->redirect(handles('blupl/franchise::approval/franchise/' . $franchise . '/' . $cateegory));
}
示例14: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(ManagementRequest $request)
{
try {
$file = Input::file('file1');
$filename1 = 'management_' . uniqid() . '.jpg';
$destinationPath = 'images/management';
$itemImage = Image::make($file)->fit(350, 450);
$itemImage->save($destinationPath . '/' . $filename1);
$request['photo'] = $destinationPath . '/' . $filename1;
$attachFile = Input::file('file2');
$filename2 = 'management_attach_' . uniqid() . '.jpg';
$destinationPathAttach = 'images/management';
$itemAttachment = Image::make($attachFile)->fit(450, 350);
$itemAttachment->save($destinationPathAttach . '/' . $filename2);
$request['attachment'] = $destinationPathAttach . '/' . $filename2;
$management = Management::create($request->all());
} catch (Exception $e) {
Flash::error('Unable to Save');
return $this->redirect(handles('blupl/management::management'));
}
Flash::success($management->name . ' Franchise Save Successfully');
return $this->redirect(handles('blupl/management::member'));
}
示例15: show
/**
* Redirect to specific page on orchestra/story.
*
* @return mixed
*/
public function show($year, $month, $day, $slug)
{
$url = implode('/', [$year, $month, $day, $slug]);
return redirect(handles("orchestra/story::{$url}"), 301);
}