本文整理汇总了PHP中Illuminate\Support\Facades\URL::to方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::to方法的具体用法?PHP URL::to怎么用?PHP URL::to使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\URL
的用法示例。
在下文中一共展示了URL::to方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
function __construct()
{
if (false == self::$enabled) {
return redirect(URL::to('/'), 302)->send();
}
Commons::init();
}
示例2: __construct
/**
* Create a new instance.
*
* @return void
*/
public function __construct()
{
//Set API base url if empty
if (empty($this->apiBaseUrl)) {
$this->apiBaseUrl = URL::to('/');
}
//Set API url if empty
if (empty($this->apiUrl)) {
$this->apiUrl = $this->apiBaseUrl . '/api/' . $this->apiVersion;
}
//Get the webste OAuth Client credentials
$oauthClient = OauthClient::where('name', '=', 'website')->first();
if (is_object($oauthClient)) {
$this->clientId = $oauthClient->id;
$this->clientSecret = $oauthClient->secret;
}
unset($oauthClient);
Blade::extend(function ($view) {
return preg_replace(array('#@translate\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@translate\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Translate::t("$1")', 'Translate::t(\'$1\')'), $view);
});
Blade::extend(function ($view) {
return preg_replace(array('#@option\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@option\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Option::getAttribute(\'$1\')', 'Option::getAttribute(\'$1\')'), $view);
});
Blade::extend(function ($view) {
return preg_replace(array('#@hasPermission\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@hasPermission\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Access::has(\'$1\')', 'Access::has(\'$1\')'), $view);
});
$this->getAccessToken();
View::share('basePath', Request::getBaseURL());
}
示例3: build
public function build()
{
$output = "";
$this->attributes["class"] = "form-control";
if (parent::build() === false) {
return;
}
switch ($this->status) {
case "disabled":
case "show":
if ($this->type == 'hidden' || $this->value == "") {
$output = "";
} elseif (!isset($this->value)) {
$output = $this->layout['null_label'];
} else {
$output = nl2br(htmlspecialchars($this->value));
}
$output = "<div class='help-block'>" . $output . "</div>";
break;
case "create":
case "modify":
Rapyd::js('packages/zofe/rapyd/assets/tinymce/tinymce.min.js');
$output = Form::textarea($this->db_name, $this->value, $this->attributes);
$output .= Rapyd::script("\n tinymce.init({\n selector: 'textarea#" . $this->name . "',\n plugins: [\n 'advlist autolink link image lists charmap print preview hr anchor pagebreak',\n 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',\n 'save table contextmenu directionality emoticons template paste textcolor responsivefilemanager'\n ],\n toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | responsivefilemanager | print preview media fullpage | forecolor backcolor emoticons', \n image_advtab: true ,\n external_filemanager_path:'" . URL::to('/') . "/packages/filemanager/',\n filemanager_title:'Upload',\n });");
break;
case "hidden":
$output = Form::hidden($this->db_name, $this->value);
break;
default:
}
$this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
}
示例4: 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;
}
示例5: postImageUpload
public function postImageUpload(Request $request)
{
// $j = 0;
// $target_path = "uploads/";
// for ($i = 0; $i < count($_FILES['file']['name']); $i++) {
// $ext = explode('.', basename($_FILES['file']['name'][$i]));
// $file_extension = end($ext);
// $target_path = $target_path . md5(uniqid()) . "." . $ext[count($ext) - 1];
// $j = $j + 1;
// move_uploaded_file($_FILES['file']['tmp_name'][$i], $target_path);
// }
$images = new Picture();
if ($request->hasFile('images')) {
$listImage = array();
$files = $request->file('images');
foreach ($files as $file) {
$name = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension();
$picture = time() . $name . '.' . $extension;
$file->move('images/product', $picture);
$src = 'images/product/' . $picture;
$product_id = 1;
$data = array('productID' => $product_id, 'imageName' => $name, 'imageSrc' => $src);
autoAssignDataToProperty($images, $data);
$listImage[] = $data;
}
$images->insert($listImage);
return redirect(URL::to('/demo/image_upload'))->withSuccess('Image Upload');
} else {
}
}
示例6: product
public function product($id)
{
// Product Detail
$product = Product::find($id);
$producer = Producer::find($product->producer);
$producerItem = "<a href='" . URL::to('/') . "/producer/" . $producer->id . "/" . strtolower($producer->producer) . ".html'>" . $producer->producer . "</a>";
// Category
$productCategoryID = Product::find($id)->category_id;
// breadcrumb
$breadcrumb = $this->breadcrumb($productCategoryID, $id);
// Best Seller
$bestSeller = $this->bestSeller();
$image = Images::where('productID', $product['id'])->first();
$thumbnail = $image['imageSrc'];
$thumbnailImage = '<a class="preView" rel="' . URL::to('/') . '/' . $thumbnail . '"><img src="' . URL::to('/') . '/' . $thumbnail . '" alt="" class="img-responsive"></a>';
$images = Images::where('productID', $id)->get();
$listImages = "";
foreach ($images as $image) {
$img = $image['imageSrc'];
$listImages .= '<a href="' . URL::to('/') . '/' . $img . '" class="fancybox-button" rel="photos-lib"><img alt="Berry Lace Dress" src="' . URL::to('/') . '/' . $img . '"></a>';
}
$review = '<div class="fb-comments" data-href="' . URL::to('/') . '/product/' . $id . '"
data-num-posts="10" data-width="700px"></div>';
return view('home.product.detail')->with(['breadcrumb' => $breadcrumb, 'product' => $product, 'producer' => $producerItem, 'bestSeller' => $bestSeller, 'thumbnailImage' => $thumbnailImage, 'listImages' => $listImages, 'review' => $review]);
}
示例7: testGetSourceSetAttribute
public function testGetSourceSetAttribute()
{
$srcset = $this->createSourceSet();
$base = URL::to('/');
$expected = "{$base}/path.jpg 200w, {$base}/path2.jpg 300w";
$this->assertEquals($expected, $srcset->getSrcSetAttribute());
}
示例8: latest
public function latest()
{
if ($this->isLoggedIn && $this->request->has('personal') && $this->request->get('personal') == 'true') {
$isCached = false;
$bans = $this->repository->getPersonalBans($this->user->settings()->playerIds());
} else {
$isCached = Cache::has('bans.latest');
$bans = $this->repository->getLatestBans();
}
if ($this->request->has('type') && $this->request->get('type') == 'rss') {
$feed = Feed::make();
$feed->title = sprintf('Latest Battlefield Bans by %s', Config::get('bfacp.site.title'));
$feed->description = sprintf('Latest Battlefield Bans by %s', Config::get('bfacp.site.title'));
$feed->setDateFormat('datetime');
$feed->link = URL::to('api/bans/latest?type=rss');
$feed->lang = 'en';
foreach ($bans as $ban) {
$title = sprintf('%s banned for %s', $ban['player']['SoldierName'], $ban['record']['record_message']);
$view = View::make('system.rss.ban_entry_content', ['playerId' => $ban['player']['PlayerID'], 'playerName' => $ban['player']['SoldierName'], 'banreason' => $ban['record']['record_message'], 'sourceName' => $ban['record']['source_name'], 'sourceId' => $ban['record']['source_id'], 'banReason' => $ban['record']['record_message']]);
$feed->add($title, $ban['record']['source_name'], $ban['player']['profile_url'], $ban['ban_startTime'], $title, $view->render());
}
return $feed->render('atom');
}
return MainHelper::response(['cols' => Lang::get('dashboard.bans.columns'), 'bans' => $bans], null, null, null, $isCached, true);
}
示例9: __toString
public function __toString()
{
$location = $this->getLocation();
$location = substr($location, 0) === '/' ? $location : '/' . $location;
$url = URLFacade::to($location);
return $location === '/' ? $url . '/' : $url;
}
示例10: absoluteUrl
/**
* Add a root if the URL is relative (helper method of the hasLink function).
*
* @return string
*/
protected function absoluteUrl()
{
if (!Str::startsWith($this->url, ['http', 'https'])) {
return URL::to($this->url);
}
return $this->url;
}
示例11: __construct
public function __construct()
{
$this->base_url = URL::to('/');
$this->upload_path = public_path() . '/uploads/';
$this->upload_url = $this->base_url . '/uploads/';
$this->script_url = $this->base_url . '/upload/';
$this->options = array('file_name' => uniqid());
}
示例12: destroy
public function destroy($id)
{
$Src = Images::find($id)->imageSrc;
$imageSrc = URL::to('/') . '/' . $Src;
File::delete($imageSrc);
Images::find($id)->delete();
return redirect(URL::previous())->withSuccess(Lang::get('messages.delete_success'));
}
示例13: redirectToPage
private function redirectToPage($page, $request)
{
$pageSlug = $page->slug;
$url = URL::to('/') . '/' . $pageSlug;
//reflash any flash messages
$request->session()->reflash();
return Redirect::to($url, 301);
}
示例14: outputMenuItems
public function outputMenuItems()
{
$list = $this->menuCategory->orderby('order', 'asc')->get();
$menuItems = array();
foreach ($list as $item) {
array_push($menuItems, ['link' => URL::to('menu/' . $item->url), 'name' => $item->name]);
}
return $menuItems;
}
示例15: link
public function link($url = null, $name = null, $class = null)
{
$url = URL::to($url, [], null);
// si no tenemos el $name pero tenemos $url
if (isset($url) && is_null($name)) {
$name = $url;
}
return view('HtmlGenerator.link', compact('name', 'url', 'class'));
}