本文整理汇总了PHP中Illuminate\Support\Facades\URL::action方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::action方法的具体用法?PHP URL::action怎么用?PHP URL::action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\URL
的用法示例。
在下文中一共展示了URL::action方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
$item = static::queryAll()->withTrashed()->find($id);
$this->fireCMSControllerEvent('showing', [$item, $id]);
$panels = $this->_show($item);
$this->layout->content = View::make('laravel-cms::cms/panels')->with('panels', $panels);
$url = \HTMLize::create($item)->url();
if ('javascript:;' != $url && $url) {
$shortcut = new \stdClass();
$shortcut->url = $url;
$shortcut->title = '网页中查看';
$this->layout->shortcuts[] = $shortcut;
}
try {
$url = URL::action(static::$action . '.edit.form', [$id]);
} catch (\InvalidArgumentException $e) {
$url = null;
}
if ($url) {
$shortcut = new \stdClass();
$shortcut->url = $url;
$shortcut->title = '打开编辑';
$this->layout->shortcuts[] = $shortcut;
}
$this->layout->title = static::$name . '详情';
}
示例2: formatModel
public function formatModel($model)
{
$script_url = str_replace(['http://', 'https://'], ['', ''], URL::to('/')) . '/zl.js';
$model->form_code = '<form class="zlform" action="' . URL::action('\\Zephia\\ZLeader\\Http\\Controllers\\Api\\LeadController@store', ['slug' => $model->slug]) . '" method="post">' . "\r\n<!-- Fields: (zlfield_example) -->\r\n" . '</form>' . "\r\n";
$model->form_code .= "<script type=\"text/javascript\">" . "\r\n" . "(function(d,s,e,t){e=d.createElement(s);e.type='text/java'+s;e.async='async';" . "\r\n" . "e.src='http'+('https:'===location.protocol?'s://':'://')+'" . $script_url . "';t=d.getElementsByTagName(s)[0];" . "\r\n" . "t.parentNode.insertBefore(e,t);})(document,'script');" . "\r\n" . "</script>";
return $model;
}
示例3: checkForUpdate
public function checkForUpdate($gamertag = '')
{
if ($this->request->ajax() && !\Agent::isRobot()) {
try {
$account = Account::with('destiny.characters')->where('seo', Text::seoGamertag($gamertag))->firstOrFail();
// We don't care about non-panda members
if (!$account->isPandaLove()) {
$this->inactiveCounter = 1;
}
// check for 10 inactive checks
if ($account->destiny->inactiveCounter >= $this->inactiveCounter) {
return response()->json(['updated' => false, 'frozen' => true, 'last_update' => 'This account hasn\'t had new data in awhile. - <a href="' . URL::action('Destiny\\ProfileController@manualUpdate', [$account->seo]) . '" class="ui horizontal green label no_underline">Update Manually</a>']);
}
$char = $account->destiny->firstCharacter();
if ($char->updated_at->diffInMinutes() >= $this->refreshRateInMinutes) {
// update this
$this->dispatch(new UpdateAccount($account));
return response()->json(['updated' => true, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]);
}
return response()->json(['updated' => false, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]);
} catch (ModelNotFoundException $e) {
return response()->json(['error' => 'Gamertag not found']);
}
}
}
示例4: block_btn_status_select
/**
* 启用禁用状态切换
* @param $item
* @return string
*/
public static function block_btn_status_select($item)
{
$url = URL::action(static::$action . '.edit.status');
if (Permission::checkMe(static::$action . '.edit.status')) {
$disabled = "";
} else {
$disabled = "disabled";
}
$current = $item->getStatus();
$token = Session::token();
$li = '';
$allowedStatus = $item->getAvailableNextStatus();
if (isset(static::$allowedStatus) && is_array(static::$allowedStatus)) {
$allowedStatus = array_intersect($allowedStatus, static::$allowedStatus);
}
foreach ($allowedStatus as $status) {
$li .= <<<LI
<li><a class="table-role-btn-switch" href="javascript:;" data-attr-id='{$item->id}' data-attr-token='{$token}' data-attr-url='{$url}' {$disabled}>{$status}</a></li>
LI;
}
$button = <<<BUTTON
<div class="btn-group" style="margin:0 auto;">
<button type="button" class="btn btn-xs btn-warning btn-current-status" {$disabled}>{$current}</button>
<button type="button" class="btn btn-xs btn-warning dropdown-toggle" data-toggle="dropdown" {$disabled}>
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
{$li}
</ul>
</div>
BUTTON;
return $button;
}
示例5: postRegister
public function postRegister()
{
$request = Request::instance();
$request->setTrustedProxies(array('192.0.0.1', '10.0.0.0/8', '127.0.0.1'));
if ($request->has("email")) {
$requestData = $request->all();
$rules = array("email" => "required|max:255|email");
$validator = Validator::make($requestData, $rules);
if ($validator->fails()) {
return redirect("/")->withErrors(array("Dit is geen correct e-mail adres."));
} else {
$email = $request->input("email");
$verificationCode = md5(uniqid(rand(), true));
DB::table("contestants")->insert(array("email" => $email, "verification_code" => $verificationCode, "verification_received" => false, "ip_address" => $request->getClientIp()));
$url = URL::action("HomeController@handleVerification", array("verify" => $verificationCode, "email" => $email));
$emailData = array("url" => $url);
Mail::send("email.email", $emailData, function ($message) use($email) {
$message->from("noreply@laravelcontest.com", "Laravel Contest");
$message->subject("Deelname wedstrijd!");
$message->to($email);
});
$data = array("email" => $email);
return view("register.success", $data);
}
//Captcha
}
return redirect()->action("HomeController@getRegister");
}
示例6: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index($subjecttype, $subjectid, Request $request)
{
$title = "Risks & Issues for {$subjecttype} " . Breadcrumbs::getSubjectName($subjecttype, $subjectid);
$breadcrumbs = Breadcrumbs::getBreadCrumb($subjecttype, $subjectid);
$breadcrumbs[] = ['Risks', URL::action('RiskAndIssueController@index', [$subjecttype, $subjectid]), true];
$risks = Risk::where('subject_type', $subjecttype)->where('subject_id', $subjectid)->get();
return view('RisksAndIssues.index', compact('subjectid', 'subjecttype', 'risks', 'title', 'breadcrumbs'));
}
示例7: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id, Request $request)
{
$subject = rag::findOrFail($id);
$subjectid = $subject->subject_id;
$subjecttype = $subject->subject_type;
$title = "Edit RAG {$subject->title} for {$subject->subject_type} " . Breadcrumbs::getSubjectName($subjecttype, $subjectid);
$breadcrumbs = Breadcrumbs::getBreadCrumb($subjecttype, $subjectid);
$breadcrumbs[] = ['RAGs', URL::action('RagController@index', [$subjecttype, $subjectid]), false];
$breadcrumbs[] = [$subject->title, '', true];
$subjecttype = 'Rag';
return view('Rags.show', compact('subject', 'title', 'breadcrumbs', 'subjectid', 'subjecttype'));
}
示例8: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id, Request $request)
{
$subject = Member::findOrFail($id);
$subjectid = $subject->subject_id;
$subjecttype = $subject->subject_type;
$username = $subject->User->name;
$title = "{$username} as {$subject->role} for {$subject->subject_type} " . Breadcrumbs::getSubjectName($subjecttype, $subjectid);
$breadcrumbs = Breadcrumbs::getBreadCrumb($subjecttype, $subjectid);
$breadcrumbs[] = ['Members', URL::action('MemberController@indexMember', [$subjecttype, $subjectid]), false];
$breadcrumbs[] = [$username, '', true];
$subjecttype = 'Member';
return view('Members.show', compact('subject', 'title', 'breadcrumbs', 'subjectid', 'subjecttype'));
}
示例9: url
public function url()
{
if (!$this->item) {
return 'javascript:;';
}
$class = get_class($this->item);
if (!array_key_exists($class, static::$modelToAction)) {
return 'javascript:;';
} else {
$dict = static::$modelToAction[$class];
if (!is_callable($dict)) {
return URL::action($dict, [$this->item->id]);
} else {
return $dict($this->item);
}
}
}
示例10: edit
public function edit($itemId)
{
$item = $this->repository->getByID($itemId);
$subjectid = $item->subject_id;
$subjecttype = $item->subject_type;
$subjectname = Breadcrumbs::getSubjectName($subjecttype, $subjectid);
$title = "Edit " . $this->getItemName() . " {$item->title} for {$item->subject_type} {$subjectname}";
$breadcrumbs = $this->getBaseBreadcrumb($subjecttype, $subjectid);
$breadcrumbs[] = [$item->title, URL::action("{$this->controllerName}@show", [$itemId]), false];
$breadcrumbs[] = ['Edit', '', false];
$meetings = $this->meetingRepository->getBySubjectTypeAndID($subjecttype, $subjectid);
$meetingid = -1;
if (isset($item->meeting_id)) {
$meetingid = $item->meeting_id;
}
return view("{$this->viewRoot}.edit", compact('item', 'title', 'breadcrumbs', 'subjectid', 'subjecttype', 'subjectname', 'meetings', 'meetingid'));
}
示例11: getIndex
public function getIndex($group = null)
{
$locales = $this->loadLocales();
$groups = Translation::groupBy('group');
$excludedGroups = $this->manager->getConfig('exclude_groups');
if ($excludedGroups) {
$groups->whereNotIn('group', $excludedGroups);
}
$groups = array('' => 'Choose a group') + $groups->lists('group', 'group');
$numChanged = Translation::where('group', $group)->where('status', Translation::STATUS_CHANGED)->count();
$allTranslations = Translation::where('group', $group)->orderBy('key', 'asc')->get();
$numTranslations = count($allTranslations);
$translations = array();
foreach ($allTranslations as $translation) {
$translations[$translation->key][$translation->locale] = $translation;
}
return \View::make('laravel-translation-manager::index')->with('translations', $translations)->with('locales', $locales)->with('groups', $groups)->with('group', $group)->with('numTranslations', $numTranslations)->with('numChanged', $numChanged)->with('editUrl', URL::action(get_class($this) . '@postEdit', array($group)))->with('deleteEnabled', $this->manager->getConfig('delete_enabled'));
}
示例12: createMenuItem
public function createMenuItem($title, $action, $parameters = null, $sub = null, $active = false)
{
$item = new \stdClass();
$item->title = $title;
if (null == $action) {
$item->active = $active;
$item->url = null;
} elseif (Permission::check($this->user, $action, $parameters)) {
//
$item->url = URL::action($action);
if (Route::current()->getName() == $action) {
$item->active = true;
} else {
$item->active = false;
}
} else {
//此用户无权限
return null;
}
$item->submenu = $sub;
return $item;
}
示例13: inPlaceEditLink
public function inPlaceEditLink($t, $withDiff = false, $key = null, $locale = null, $useDB = null, $group = null)
{
try {
$this->suspendUsageLogging();
$diff = '';
if (!$t && $key) {
if ($useDB === null) {
$useDB = $this->useDB;
}
list($namespace, $parsed_group, $item) = $this->parseKey($key);
if ($group === null) {
$group = $parsed_group;
} else {
$item = substr($key, strlen("{$group}."));
if ($namespace && $namespace !== '*') {
$group = substr($group, strlen("{$namespace}::"));
}
}
if ($this->manager && $group && $item && (!$this->manager->excludedPageEditGroup($group) || $withDiff)) {
if ($locale == null) {
$locale = $this->locale();
}
$t = $this->manager->missingKey($namespace, $group, $item, $locale, false, true);
if ($t && (!$t->exists || $t->value == '') && $namespace != '*') {
if (static::isLaravelNamespace($namespace)) {
// get the package definition, we don't have an override
$t->saved_value = parent::get($key, [], $locale);
$t->status = 0;
if ($withDiff) {
$diff = ' [' . $t->saved_value . ']';
}
}
}
}
}
if ($t) {
if ($withDiff && $diff === '') {
$diff = $t->saved_value == $t->value ? '' : ($t->saved_value === $t->value ? '' : ' [' . mb_renderDiffHtml($t->saved_value, $t->value) . ']');
}
$title = parent::get($this->packagePrefix . 'messages.enter-translation');
if ($t->value === null) {
$t->value = '';
}
//$t->value = parent::get($key, $replace, $locale);
$result = '<a href="#edit" class="vsch_editable status-' . ($t->status ?: 0) . ' locale-' . $t->locale . '" data-locale="' . $t->locale . '" ' . 'data-name="' . $t->locale . '|' . $t->key . '" id="' . $t->locale . "-" . str_replace('.', '-', $t->key) . '" data-type="textarea" data-pk="' . ($t->id ?: 0) . '" ' . 'data-url="' . URL::action(ManagerServiceProvider::CONTROLLER_PREFIX . 'Vsch\\TranslationManager\\Controller@postEdit', array($t->group)) . '" ' . 'data-inputclass="editable-input" data-saved_value="' . htmlentities($t->saved_value, ENT_QUOTES, 'UTF-8', false) . '" ' . 'data-title="' . $title . ': [' . $t->locale . '] ' . $t->group . '.' . $t->key . '">' . ($t ? htmlentities($t->value, ENT_QUOTES, 'UTF-8', false) : '') . '</a> ' . $diff;
return $result;
}
return '';
} finally {
$this->resumeUsageLogging();
}
}
示例14: update
/**
* 保存编辑数据
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
$item = static::queryAll()->find($id);
if (null === $item) {
KMessager::push('找不到对应的数据', KMessager::ERROR);
return Redirect::action(static::$action . '.show.index');
}
$form = $this->_form($id, $item);
if ($form->validation()) {
// validate ok
$this->fireCMSControllerEvent('updating', [$form, $item, $id]);
$this->_store($form, $item, $id);
$link = '';
try {
$link .= HTML::link(URL::action(static::$action . '.show.detail', [$item->id]), ' 查看详情 ', ['target' => '_blank']);
} catch (InvalidArgumentException $e) {
$link .= '';
}
$url = \HTMLize::create($item)->url();
if ('javascript:;' != $url && $url) {
$link .= HTML::link($url, ' 查看网页 ', ['target' => '_blank']);
}
try {
$url = URL::action(static::$action . '.edit.form', [$item->id]);
} catch (InvalidArgumentException $e) {
$url = null;
}
if ($url) {
$link .= HTML::link($url, ' 重新编辑 ', ['target' => '_blank']);
}
KMessager::push('更新记录成功' . $link);
return Redirect::action(static::$action . '.show.index');
} else {
// 以下方式会导致chrome崩溃掉...
//Session::flash( 'flashdata_create_form' , $form );
//return Redirect::action( static::$action . '.create' );
$this->layout->content = View::make('laravel-cms::cms/form')->with('form', $form);
}
}
示例15: getPath
/**
* Get an URL.
*
* @param string $route
* @param array $parameters
*
* @return string
*/
protected function getPath($route, $parameters = [])
{
return URL::action(get_class($this) . '@' . $route, $parameters);
}