本文整理汇总了PHP中link_to_route函数的典型用法代码示例。如果您正苦于以下问题:PHP link_to_route函数的具体用法?PHP link_to_route怎么用?PHP link_to_route使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了link_to_route函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSocialLinks
/**
* Generates social login links based on what is enabled
*
* @return string
*/
public function getSocialLinks()
{
$socialite_enable = [];
$socialite_links = '';
if (strlen(getenv('BITBUCKET_CLIENT_ID'))) {
$socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Bit Bucket']), 'bitbucket');
}
if (strlen(getenv('FACEBOOK_CLIENT_ID'))) {
$socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Facebook']), 'facebook');
}
if (strlen(getenv('GOOGLE_CLIENT_ID'))) {
$socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Google']), 'google');
}
if (strlen(getenv('GITHUB_CLIENT_ID'))) {
$socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Github']), 'github');
}
if (strlen(getenv('LINKEDIN_CLIENT_ID'))) {
$socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Linked In']), 'linkedin');
}
if (strlen(getenv('TWITTER_CLIENT_ID'))) {
$socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Twitter']), 'twitter');
}
for ($i = 0; $i < count($socialite_enable); $i++) {
$socialite_links .= ($socialite_links != '' ? ' | ' : '') . $socialite_enable[$i];
}
return $socialite_links;
}
示例2: table
/**
* Returns a new table of all stocks of the specified inventory item.
*
* @param Inventory $item
*
* @return \Orchestra\Contracts\Html\Builder
*/
public function table(Inventory $item)
{
$stocks = $item->stocks();
return $this->table->of('inventory.stocks', function (TableGrid $table) use($item, $stocks) {
$table->with($stocks);
$table->attributes(['class' => 'table table-hover table-striped']);
$table->column('quantity');
$table->column('location', function (Column $column) use($item) {
$column->value = function (InventoryStock $stock) use($item) {
$name = $stock->location->trail;
return link_to_route('maintenance.inventory.stocks.show', $name, [$item->getKey(), $stock->getKey()]);
};
});
$table->column('last_movement', function (Column $column) {
$column->value = function (InventoryStock $stock) {
return $stock->last_movement;
};
});
$table->column('last_movement_by', function (Column $column) {
$column->value = function (InventoryStock $stock) {
return $stock->last_movement_by;
};
});
});
}
示例3: link
/**
*
* @return string
*/
public function link()
{
if (Auth::user()->hasPermission(Permission::PERMISSION_VIEW_UCIONICA)) {
return link_to_route('Ucionica.show', $this->naziv, array('id' => $this->id));
}
return $this->naziv;
}
示例4: table
/**
* Returns a new table of inquiry categories.
*
* @param \Illuminate\Database\Eloquent\Builder|Category $category
* @param Inquiry $inquiry
*
* @return \Orchestra\Contracts\Html\Builder
*/
public function table($category, Inquiry $inquiry)
{
if ($category->exists) {
// If the category exists we're looking to display it's children.
$category = $category->children();
} else {
// Otherwise we're displaying root nodes.
$category = $category->whereIsRoot()->whereBelongsTo($inquiry->getTable());
}
return $this->table->of('inquiries.categories', function (TableGrid $table) use($category) {
$table->with($category)->paginate($this->perPage);
$table->layout('pages.categories._table');
$table->column('name', function (Column $column) {
$column->value = function (Category $category) {
return link_to_route('inquiries.categories.index', $category->name, [$category->id]);
};
});
$table->column('sub-categories', function (Column $column) {
$column->value = function (Category $category) {
return $category->children()->count();
};
});
$table->column('delete', function (Column $column) {
$column->value = function (Category $category) {
$route = 'inquiries.categories.destroy';
return link_to_route($route, 'Delete', [$category->id], ['data-post' => 'DELETE', 'data-title' => 'Delete Category?', 'data-message' => 'Are you sure you want to delete this category? All child categories will be destroyed.', 'class' => 'btn btn-xs btn-danger']);
};
});
});
}
示例5: table
/**
* Returns a new table of all computer types.
*
* @param ComputerType $type
*
* @return \Orchestra\Contracts\Html\Builder
*/
public function table(ComputerType $type)
{
return $this->table->of('computers.types', function (TableGrid $table) use($type) {
$table->with($type)->paginate($this->perPage);
$table->column('name');
$table->column('created_at_human', function (Column $column) {
$column->label = 'Created';
$column->headers = ['class' => 'hidden-xs'];
$column->attributes = function () {
return ['class' => 'hidden-xs'];
};
});
$table->column('edit', function (Column $column) {
$column->label = 'Edit';
$column->value = function (ComputerType $type) {
return link_to_route('computer-types.edit', 'Edit', [$type->id], ['class' => 'btn btn-xs btn-warning']);
};
});
$table->column('delete', function (Column $column) {
$column->label = 'Delete';
$column->value = function (ComputerType $type) {
return link_to_route('computer-types.destroy', 'Delete', [$type->id], ['data-post' => 'DELETE', 'data-title' => 'Are you sure?', 'data-message' => 'Are you sure you want to delete this computer type?', 'class' => 'btn btn-xs btn-danger']);
};
});
});
}
示例6: recurse_pages
function recurse_pages($pages, $spaces = 0, $layoutsBlocks = [], $pageWidgets = [], $pagesWidgets = [])
{
$data = '';
foreach ($pages as $page) {
// Блок
$currentBlock = array_get($pageWidgets, $page['id'] . '.0');
$currentPosition = array_get($pageWidgets, $page['id'] . '.1');
$data .= '<tr data-id="' . $page['id'] . '" data-parent-id="' . $page['parent_id'] . '">';
$data .= '<td>';
if (!empty($page['childs'])) {
$data .= '<div class="input-group">';
}
$data .= Form::select('blocks[' . $page['id'] . '][block]', [], $currentBlock, ['class' => 'widget-blocks form-control', 'data-layout' => $page['layout_file'], 'data-value' => $currentBlock]);
if (!empty($page['childs'])) {
$data .= "<div class=\"input-group-btn\">" . Form::button(NULL, ['data-icon' => 'level-down', 'class' => 'set_to_inner_pages btn btn-warning', 'title' => trans('widgets::core.button.select_childs')]) . '</div></div>';
}
$data .= '</td><td>';
$data .= Form::text('blocks[' . $page['id'] . '][position]', (int) $currentPosition, ['maxlength' => 4, 'size' => 4, 'class' => 'form-control text-right widget-position']);
$data .= '</td><td></td>';
if (acl_check('page::edit')) {
$data .= '<th>' . str_repeat("- ", $spaces) . link_to_route('backend.page.edit', $page['title'], [$page['id']]) . '</th>';
} else {
$data .= '<th>' . str_repeat("- ", $spaces) . $page['title'] . '</th>';
}
$data .= '</tr>';
if (!empty($page['childs'])) {
$data .= recurse_pages($page['childs'], $spaces + 5, $layoutsBlocks, $pageWidgets, $pagesWidgets);
}
}
return $data;
}
示例7: show
public function show($userId = false, $goalId)
{
if ($userId) {
if (!$this->currentUser->isStaff() and $this->currentUser->id != $userId) {
if ($this->currentUser->plan) {
return redirect()->route('plan', [$this->currentUser->id]);
}
return $this->unauthorized("You do not have permission to see development plans for other students.");
}
// Get the user
$user = (!$this->currentUser->isStaff() and $this->currentUser->id == $userId) ? $this->currentUser : $this->usersRepo->find($userId);
} else {
// Get the user
$user = $this->currentUser;
// Set the userId
$userId = $user->id;
}
// Load the plan and goals from the user object
$user = $user->load('plan');
// Get the goal
$goal = $this->goalsRepo->getById($goalId);
if (!$goal) {
return $this->errorNotFound("No such goal exists in your development plan. Please return to your " . link_to_route('plan', 'development plan', [$this->currentUser->id]) . " and try again.");
}
// Get the goal timeline
$timeline = $this->goalsRepo->getUserGoalTimeline($user->plan, $goalId);
return view('pages.devplans.goal', compact('goal', 'timeline', 'userId', 'user'));
}
示例8: store
/**
* Creates a new work order for the specified
* request.
*
* @param string|int $requestId
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/
public function store($requestId)
{
$workRequest = $this->workRequest->find($requestId);
/*
* If a work order already exists for this request, we'll return
* an error and let the user know
*/
if ($workRequest->workOrder) {
$link = link_to_route('maintenance.work-orders.show', 'Show Work Order', [$workRequest->workOrder->id]);
$this->message = "A work order already exists for this work request. {$link}";
$this->messageType = 'warning';
$this->redirect = routeBack('maintenance.work-requests.index');
return $this->response();
}
$workOrder = $this->workOrder->createFromWorkRequest($workRequest);
if ($workOrder) {
$link = link_to_route('maintenance.work-orders.show', 'Show', [$workOrder->id]);
$this->message = "Successfully generated work order. {$link}";
$this->messageType = 'success';
$this->redirect = routeBack('maintenance.work-orders.show', [$workOrder->id]);
} else {
$message = 'There was an issue trying to generate a work order for this request.
If a work order was deleted that was attached to this request, it will have to be removed/recovered by
an administrator before generating another work order.';
$this->message = $message;
$this->messageType = 'danger';
$this->redirect = routeBack('maintenance.work-orders.requests.create', [$requestId]);
}
return $this->response();
}
示例9: userProfileLink
/**
* @return string
*/
public function userProfileLink()
{
$avatarSrc = $this->userAvatar();
$avatar = '<img class="img-circle space-right5 display-inline-block" style="max-width: 32px;" data-src="' . $avatarSrc . '">';
$name = is_null($this->entity->deleted_at) ? link_to_route('user.show', str_limit($this->entity->name, 25), [$this->entity->id]) : str_limit($this->entity->name, 25);
return $avatar . ' ' . $name;
}
示例10: table
/**
* Returns a table of all inventory items.
*
* @param Inventory|\Illuminate\Database\Eloquent\Builder $item
*
* @return \Orchestra\Contracts\Html\Builder
*/
public function table($item)
{
return $this->table->of('inventory', function (TableGrid $table) use($item) {
$table->with($item)->paginate($this->perPage);
$table->attributes(['class' => 'table table-hover table-striped']);
$table->column('ID', 'id');
$table->column('sku', function (Column $column) {
$column->label = 'SKU';
$column->value = function (Inventory $item) {
return $item->getSku();
};
});
$table->column('name', function (Column $column) {
$column->value = function (Inventory $item) {
return link_to_route('maintenance.inventory.show', $item->name, [$item->getKey()]);
};
});
$table->column('category', function (Column $column) {
$column->value = function (Inventory $item) {
return $item->category->trail;
};
});
$table->column('current_stock', function (Column $column) {
$column->value = function (Inventory $item) {
return $item->getTotalStock();
};
});
});
}
示例11: table
/**
* Returns a new table of all operating systems.
*
* @param OperatingSystem $system
*
* @return \Orchestra\Contracts\Html\Builder
*/
public function table(OperatingSystem $system)
{
return $this->table->of('computers.operating-systems', function (TableGrid $table) use($system) {
$table->with($system)->paginate($this->perPage);
$table->column('name');
$table->column('version', function (Column $column) {
$column->headers = ['class' => 'hidden-xs'];
$column->attributes = function () {
return ['class' => 'hidden-xs'];
};
});
$table->column('service_pack', function (Column $column) {
$column->headers = ['class' => 'hidden-xs'];
$column->attributes = function () {
return ['class' => 'hidden-xs'];
};
});
$table->column('edit', function (Column $column) {
$column->label = 'Edit';
$column->value = function (OperatingSystem $system) {
return link_to_route('computer-systems.edit', 'Edit', [$system->id], ['class' => 'btn btn-xs btn-warning']);
};
});
$table->column('delete', function (Column $column) {
$column->label = 'Delete';
$column->value = function (OperatingSystem $system) {
return link_to_route('computer-systems.destroy', 'Delete', [$system->id], ['data-post' => 'DELETE', 'data-title' => 'Are you sure?', 'data-message' => 'Are you sure you want to delete this operating system?', 'class' => 'btn btn-xs btn-danger']);
};
});
});
}
示例12: handle
/**
* Execute the job.
*
* @return bool
*/
public function handle()
{
// Get the requested quantity to return
$quantity = $this->request->input('quantity');
// We'll double check that the stock model we've been given contains
// the pivot attribute, indicating it's been retrieved
// from the work order.
if ($this->stock->pivot instanceof Pivot) {
if ($quantity > $this->stock->pivot->quantity) {
// If the quantity entered is greater than the
// taken stock, we'll return all of the stock.
$returnQuantity = $this->stock->pivot->quantity;
} else {
// Otherwise we can use the users quantity input.
$returnQuantity = $quantity;
}
// Set the stock put reason.
$reason = link_to_route('maintenance.work-orders.show', 'Put Back from Work Order', [$this->workOrder->getKey()]);
// Return the specified quantity.
$this->stock->put($returnQuantity, $reason);
// Retrieve the left over quantity for the work order.
$newQuantity = $this->stock->pivot->quantity - $returnQuantity;
if ($newQuantity == 0) {
// If the new quantity is zero, we'll detach the
// stock record from the work order parts.
$this->workOrder->parts()->detach($this->stock->getKey());
} else {
// Otherwise we'll update the quantity on the pivot record.
$this->workOrder->parts()->updateExistingPivot($this->stock->getKey(), ['quantity' => $newQuantity]);
}
return true;
}
return false;
}
示例13: sort_projects_by
function sort_projects_by($column, $body)
{
$direction = Request::get('direction') == 'asc' ? 'desc' : 'asc';
$search = Request::get('str') ? Request::get('str') : '';
$year = Request::get('year') ? Request::get('year') : '';
return link_to_route('projects', $body, ['sortBy' => $column, 'direction' => $direction, 'str' => $search, 'year' => $year]);
}
示例14: getFunctions
/**
* @return array
*/
public function getFunctions()
{
return [new Twig_SimpleFunction('user', [$this, 'getUserValue'], ['is_safe' => ['html']]), new Twig_SimpleFunction('user_input', function ($name) {
return request($name, $this->getUserValue($name));
}), new Twig_SimpleFunction('link_to_profile', function () {
$args = func_get_args();
if (is_array($args[0])) {
$userId = isset($args['user_id']) ? $args['user_id'] : $args['id'];
$name = isset($args['user_name']) ? $args['user_name'] : $args['name'];
$isActive = $args['is_active'];
$isBlocked = $args['is_blocked'];
} else {
$userId = array_shift($args);
$name = array_shift($args);
$isActive = array_shift($args);
$isBlocked = array_shift($args);
}
$attributes = ['data-user-id' => $userId];
if ($isBlocked || !$isActive) {
$attributes['class'] = 'del';
}
return link_to_route('profile', $name, $userId, $attributes);
}, ['is_safe' => ['html']]), new Twig_SimpleFunction('user_photo', function ($photo) {
return $photo ? asset('storage/photo/' . $photo) : asset('img/avatar.png');
}), new Twig_SimpleFunction('can', function ($ability, $policy) {
return Auth::guest() ? false : policy($policy)->{$ability}(auth()->user(), $policy);
})];
}
示例15: fa_link_to_route
function fa_link_to_route($route, $text, $icon = '', $params = array(), $attrs = array())
{
if ($icon) {
$text = '<i class="fa fa-' . $icon . '"></i> ' . $text;
}
return link_to_route($route, $text, $params, $attrs);
}