当前位置: 首页>>代码示例>>PHP>>正文


PHP URL::asset方法代码示例

本文整理汇总了PHP中URL::asset方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::asset方法的具体用法?PHP URL::asset怎么用?PHP URL::asset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在URL的用法示例。


在下文中一共展示了URL::asset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getWishlist

 public static function getWishlist()
 {
     $user_id = Session::get('user_id');
     $error_code = ApiResponse::OK;
     $pagination = ApiResponse::pagination();
     if ($pagination == false) {
         $error_code = ApiResponse::URL_NOT_EXIST;
         $data = ApiResponse::getErrorContent(ApiResponse::URL_NOT_EXIST);
     } else {
         $page = $pagination['page'];
         $limit = $pagination['limit'];
         $wishlists = Wishlist::where('user_id', $user_id)->with('wine')->forPage($page, $limit)->get();
         if (count($wishlists) == 0) {
             $data = array();
         } else {
             foreach ($wishlists as $wishlist) {
                 $wishlist->winery = Winery::where('id', $wishlist->wine->winery_id)->first();
                 if ($wishlist->wine->image_url != null) {
                     $wishlist->wine->image_url = URL::asset($wishlist->wine->image_url);
                 }
                 if ($wishlist->wine->wine_flag != null) {
                     $wishlist->wine->wine_flag = URL::asset($wishlist->wine->wine_flag);
                 }
             }
             $data = $wishlists->toArray();
         }
     }
     return array("code" => $error_code, "data" => $data);
 }
开发者ID:anht37,项目名称:winelover_server,代码行数:29,代码来源:Wishlist.php

示例2: testGetRankingSuccess

 public function testGetRankingSuccess()
 {
     $user_id = $this->_user_id;
     $_params = $this->_params;
     $_params['user_id'] = $user_id;
     $response = $this->_getAuth($_params);
     //get created login information
     $page = 1;
     $limit = 10;
     $user = Profile::orderBy('rate_count', 'desc')->forPage($page, $limit)->get();
     if (count($user) != 0) {
         foreach ($user as $users) {
             $follow = Follow::where('from_id', $user_id)->where('to_id', $users->user_id)->first();
             if ($follow) {
                 $users->is_follow = true;
             } else {
                 if ($users->user_id != $user_id) {
                     $users->is_follow = false;
                 }
             }
             if ($users->image != null) {
                 $users->image = URL::asset($users->image);
             }
         }
     }
     $this->assertNotNull($user);
     $this->assertEquals(array("code" => ApiResponse::OK, "data" => $user->toArray()), json_decode($response->getContent(), true));
 }
开发者ID:anht37,项目名称:winelover_server,代码行数:28,代码来源:RankingTest.php

示例3: js_init

   public function js_init($params = array())
   {
       if (!isset($params['score'])) {
           $params['score'] = 'function() { return $(this).attr(\'data-score\'); }';
       }
       if (!isset($params['number'])) {
           $params['number'] = '5';
       }
       if (!isset($params['click'])) {
           $params['click'] = 'function(score, evt) {
               $(\'input[name="lraty-\' + $(this).attr(\'data-item\') + \'"]\').val(score);
             }';
       }
       if (!isset($params['path'])) {
           $params['path'] = '\'' . \URL::asset('packages/lraty/images') . '\'';
       }
       $options = '';
       foreach ($params as $key => $value) {
           $options .= '\'' . $key . '\':' . $value . ',';
       }
       $options = substr($options, 0, -1);
       //removing last comma
       $code = '<script type="text/javascript">
       $(document).ready(function() {
 			$(\'body #lraty\').raty({' . $options . '});
       });
 			</script>';
       return $code;
   }
开发者ID:vahanmargaryan,项目名称:lraty,代码行数:29,代码来源:Lraty.php

示例4: searchAjax

    public function searchAjax()
    {
        $response = '';
        $search_term = trim(e(Input::get('search_term')));
        $domains = Domain::where('status', 1)->where('name', 'LIKE', '%' . $search_term . '%')->orWhere('url', 'LIKE', '%' . $search_term . '%')->orWhere('description', 'LIKE', '%' . $search_term . '%')->take(5)->get(['id', 'name', 'thumb']);
        if (count($domains)) {
            foreach ($domains as $domain) {
                $domain_name = strlen($domain->name) > 30 ? substr($domain->name, 0, 30) . '...' : $domain->name;
                $response .= '<div class="search-box">
					<a class="search-result-row" href="' . Domain::seoURL($domain->id) . '">
						<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
							<img class="img img-responsive thumbnail" 
								src="' . URL::asset('assets/thumbs/' . $domain->thumb) . '" alt="site preview" />
						</div>			
						<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
							' . $domain_name . '	
						</div>	
						<div class="clearfix"></div>
					</a>	
					</div>';
            }
        } else {
            $response .= '<p>' . Lang::get('general.no_results', ['serch_term' => $search_term]) . '</p>';
        }
        print $response;
    }
开发者ID:CalinB,项目名称:web-directory,代码行数:26,代码来源:HomeController.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('modpacks')->delete();
     $testmodpack = Modpack::create(array('name' => 'TestModpack', 'slug' => 'testmodpack', 'icon' => false, 'icon_md5' => md5_file(public_path() . '/resources/default/icon.png'), 'icon_url' => URL::asset('/resources/default/icon.png'), 'logo' => false, 'logo_md5' => md5_file(public_path() . '/resources/default/logo.png'), 'logo_url' => URL::asset('/resources/default/logo.png'), 'background' => false, 'background_md5' => md5_file(public_path() . '/resources/default/background.jpg'), 'background_url' => URL::asset('/resources/default/background.jpg')));
     DB::table('builds')->delete();
     $testbuild = Build::create(array('modpack_id' => $testmodpack->id, 'version' => '1.0.0', 'minecraft' => '1.7.10', 'minecraft_md5' => 'e6b7a531b95d0c172acb704d1f54d1b3', 'min_java' => '1.7', 'min_memory' => '1024', 'is_published' => true));
 }
开发者ID:NorthPL,项目名称:Solder-for-NorthLauncher,代码行数:12,代码来源:ModpackTableTestSeeder.php

示例6: displayFamilyProfilePicture

function displayFamilyProfilePicture($family)
{
    if ($family && File::exists($family->image_url)) {
        return URL::asset($family->image_url);
    } else {
        return URL::asset('adminlte/dist/img/user2-160x160.jpg');
    }
}
开发者ID:danielsamfdo,项目名称:applara,代码行数:8,代码来源:application_helper.php

示例7: getLeadImageUrlAttribute

 public function getLeadImageUrlAttribute()
 {
     if ($this->lead_image) {
         $leadImageUrl = URL::asset('/uploads/' . $this->id . '/' . $this->lead_image);
     } else {
         $leadImageUrl = URL::asset('/img/missing-image.jpg');
     }
     return $leadImageUrl;
 }
开发者ID:ndamnjanovic,项目名称:laravel-classifieds,代码行数:9,代码来源:Classified.php

示例8: getEdit

 public function getEdit($user)
 {
     \AssetManager::addStyle(\URL::asset('chosen_v1.3.0/chosen.css'));
     \AssetManager::addScript(\URL::asset('chosen_v1.3.0/chosen.jquery.js'));
     \AssetManager::addScript(\URL::asset('js/chosenpicker.js'));
     $title = 'Users';
     $roles = $user->roles()->lists('id', 'name');
     error_log('>>> Roles ' . json_encode($roles));
     $html = view('admin.users.edit', compact('title', 'user', 'roles'))->render();
     return Admin::view($html);
 }
开发者ID:strikles,项目名称:php,代码行数:11,代码来源:AdminUsersController.php

示例9: testGetTimelineSuccess

 public function testGetTimelineSuccess()
 {
     $this->setUpRating();
     $this->setUpCountry();
     $this->setUpWineNote();
     $this->setUpProfile();
     $_params = $this->_params;
     $_params['user_id'] = "user_id";
     $response = $this->_getAuth($_params);
     $error_code = ApiResponse::OK;
     $user_timeline = array();
     $user_timeline[] = $this->_user_id;
     $user_follow = Follow::where('from_id', $this->_user_id)->orderBy('updated_at', 'asc')->get();
     if (isset($user_follow)) {
         foreach ($user_follow as $user) {
             $user_timeline[] = $user->to_id;
         }
     }
     $pagination = ApiResponse::pagination();
     $page = $pagination['page'];
     $limit = $pagination['limit'];
     $wine = Wine::with('winery')->forPage($page, $limit)->get();
     $ratings = Rating::whereIn('user_id', $user_timeline)->whereNotNull('wine_unique_id')->with('profile')->with('wine')->forPage($page, $limit)->get();
     foreach ($ratings as $rating) {
         $winery = Winery::where('id', $rating->wine->winery_id)->first();
         $rating->winery = $winery;
         $country = Country::where('id', $rating->winery->country_id)->first();
         $rating->winery->country_name = $country->country_name;
         $like = Like::where('user_id', $this->_user_id)->where('rating_id', $rating->id)->first();
         if ($like) {
             $rating->liked = true;
         } else {
             $rating->liked = false;
         }
         $wishlist = Wishlist::where('user_id', $this->_user_id)->where('wine_unique_id', $rating->wine_unique_id)->first();
         if ($wishlist) {
             $rating->wishlist = true;
         } else {
             $rating->wishlist = false;
         }
         if ($rating->wine->image_url != null) {
             $rating->wine->image_url = URL::asset($rating->wine->image_url);
         }
         if ($rating->wine->wine_flag != null) {
             $rating->wine->wine_flag = URL::asset($rating->wine->wine_flag);
         }
         if ($rating->profile->image != null) {
             $rating->profile->image = URL::asset($rating->profile->image);
         }
         $rating->winery = $rating->winery->toArray();
     }
     $data = $ratings;
     $this->assertEquals(array("code" => ApiResponse::OK, "data" => $ratings->toArray()), json_decode($response->getContent(), true));
 }
开发者ID:anht37,项目名称:winelover_server,代码行数:54,代码来源:TimelineTest.php

示例10: getEdit

 public function getEdit($group)
 {
     \AssetManager::addStyle(\URL::asset('chosen_v1.3.0/chosen.css'));
     \AssetManager::addScript(\URL::asset('chosen_v1.3.0/chosen.jquery.js'));
     \AssetManager::addScript(\URL::asset('js/chosenpicker.js'));
     $title = 'Groups';
     $users = $group->users()->get();
     $gusers = $users->lists('name', 'id');
     error_log(json_encode($gusers));
     $html = view('admin.groups.edit', compact('title', 'group', 'gusers'))->render();
     return Admin::view($html);
 }
开发者ID:strikles,项目名称:php,代码行数:12,代码来源:AdminGroupsController.php

示例11: store

 public function store($request)
 {
     $input = $request->all();
     $image = $request->file('file');
     if (strpos($image->getClientMimeType(), 'image') !== FALSE) {
         $upload_folder = 'img-product/';
         $file_name = str_random() . '.' . $image->getClientOriginalExtension();
         $image->move(public_path($upload_folder) . '/', $file_name);
         echo URL::asset($upload_folder . $file_name);
         // get upload file url
         $input['imageurl'] = $upload_folder . $file_name;
         $p = Ingredient::create($input);
     }
     return $p;
 }
开发者ID:jkevinp,项目名称:bepco,代码行数:15,代码来源:EloquentIngredientRepository.php

示例12: upload

 public function upload()
 {
     $file = Input::file('upload');
     $destinationPath = public_path() . '/files';
     // If the uploads fail due to file system, you can try doing public_path().'/uploads'
     $filename = $file->getClientOriginalName();
     //$extension =$file->getClientOriginalExtension();
     $upload_success = $file->move($destinationPath, $filename);
     if ($upload_success) {
         $CKEditorFuncNum = Input::get('CKEditorFuncNum');
         $url = \URL::asset("files/" . $filename);
         $re = "window.parent.CKEDITOR.tools.callFunction({$CKEditorFuncNum}, '{$url}', 'Изображение успешно загружено')";
     } else {
         $re = "alert('При загрузке произошла ошибка')";
     }
     return "<script>{$re};</script>";
 }
开发者ID:Khelek,项目名称:ipsol,代码行数:17,代码来源:UploadsController.php

示例13: start

 public function start($game)
 {
     Session::flush();
     $openid = Input::get('openid') ? Input::get('openid') : null;
     $CODE = Input::get('code') ? Input::get('code') : 'gg';
     Session::put('openid', $openid);
     Session::flash('code', $CODE);
     //检测微信浏览器
     //          if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false )
     //          {
     //
     //          }
     //            else
     //            {
     //                return Response::make('请使用微信浏览器~', 403);
     //            }
     //_token验证
     $_token = csrf_token();
     Session::put('_token', $_token);
     //分享数据和验证_token
     $arr = array('_token' => $_token, 'url' => "http://202.202.43.41/game/public/2048/2048_main", 'path' => URL::asset('asset/pic/2048.png'));
     switch ($game) {
         case 'run':
             return View::make('run.index')->with("arr", $arr);
             break;
         case 'sun':
             return View::make('sun.index')->with("arr", $arr);
             break;
         case '2048':
             return View::make('2048.index')->with("arr", $arr);
             break;
         case 'praise-xi':
             return View::make('praise-xi.index');
         case 'takephotos':
             DB::table('view')->where('id', '=', 1)->increment('view');
             return View::make('takephotos.index');
         case 'goodcitizen':
             DB::table('view')->where('id', '=', 2)->increment('view');
             $token = sha1(time() . sha1('redrock'));
             Session::flash('token', $token);
             return View::make('goodcitizen.index')->with('token', $token);
         default:
             return Response::make("Page not found", 404);
             break;
     }
 }
开发者ID:Willshon,项目名称:redrock_html5_games,代码行数:46,代码来源:HomeController.php

示例14: Display

 public static function Display($layer, $findLayers)
 {
     $Layers = Layer::all();
     $output = "";
     $cakeid = $_SESSION['cakeModelID'];
     //$layer-mao ni ang box nga gi buhat sa html
     // $category=$_SESSION['Category'];
     foreach ($Layers as $layerss) {
         if ($layer == 'choosebox') {
             if ($findLayers == 'BaseLayer' && $layerss['BaseLayer'] == 1) {
                 $output .= "\t\t\t<div id='" . $layerss["id"] . "'>" . '<img src="' . URL::asset('img/upload/layers/' . $layerss['image']) . '" height="100" width="100" /> ' . "</div>\n";
             } elseif ($findLayers == 'Toppers' && $layerss['Toppers'] == 1) {
                 $output .= "\t\t\t<div id='" . $layerss["id"] . "'>" . '<img src="' . URL::asset('img/upload/layers/' . $layerss['image']) . '" height="100" width="100" /> ' . "</div>\n";
             }
         } elseif ($_SESSION['findLayers'] == 'BaseLayer') {
             //query ang cake model where kato gi session nako nga id sa cakemodel
             $cakeModel = cakeModel::where('id', '=', $cakeid)->get();
             foreach ($cakeModel as $model) {
                 //gi query ang cake nya gi compare2 if unsai sud && gi tanaw unsa na box ang outputan
                 if ($model['layer1'] == $layerss["id"] && $layer == 'layer1') {
                     $output .= "\t\t\t<div id='" . $layerss["id"] . "'>" . '<img src="' . URL::asset('img/upload/layers/' . $layerss['image']) . '" height="100" width="100" /> ' . "</div>\n";
                 } elseif ($model['layer2'] == $layerss["id"] && $layer == 'layer2') {
                     $output .= "\t\t\t<div id='" . $layerss["id"] . "'>" . '<img src="' . URL::asset('img/upload/layers/' . $layerss['image']) . '" height="100" width="100" /> ' . "</div>\n";
                 } elseif ($model['layer3'] == $layerss["id"] && $layer == 'layer3') {
                     $output .= "\t\t\t<div id='" . $layerss["id"] . "'>" . '<img src="' . URL::asset('img/upload/layers/' . $layerss['image']) . '" height="100" width="100" /> ' . "</div>\n";
                 }
             }
         } elseif ($_SESSION['findLayers'] == 'Toppers') {
             //query ang cake model where kato gi session nako nga id sa cakemodel
             $cakeModel = cakeModel::where('id', '=', $cakeid)->get();
             foreach ($cakeModel as $model) {
                 //gi query ang cake nya gi compare2 if unsai sud && gi tanaw unsa na box ang outputan
                 if ($model['layer1topper'] == $layerss["id"] && $layer == 'layer1') {
                     $output .= "\t\t\t<div id='" . $layerss["id"] . "'>" . '<img src="' . URL::asset('img/upload/layers/' . $layerss['image']) . '" height="100" width="100" /> ' . "</div>\n";
                 } elseif ($model['layer2topper'] == $layerss["id"] && $layer == 'layer2') {
                     $output .= "\t\t\t<div id='" . $layerss["id"] . "'>" . '<img src="' . URL::asset('img/upload/layers/' . $layerss['image']) . '" height="100" width="100" /> ' . "</div>\n";
                 } elseif ($model['layer3topper'] == $layerss["id"] && $layer == 'layer3') {
                     $output .= "\t\t\t<div id='" . $layerss["id"] . "'>" . '<img src="' . URL::asset('img/upload/layers/' . $layerss['image']) . '" height="100" width="100" /> ' . "</div>\n";
                 }
             }
         }
     }
     return $output;
 }
开发者ID:jeraldpunx,项目名称:3dCakeMaker,代码行数:44,代码来源:Helper.php

示例15: testGetListRatingMyWineSuccess

 public function testGetListRatingMyWineSuccess()
 {
     $this->setUpRating();
     $response = $this->call('GET', 'api/rating');
     $page = 1;
     $limit = 10;
     $rating = Rating::where('user_id', $this->_user_id)->where('is_my_wine', 1)->with('wine')->orderBy('updated_at', 'desc')->forPage($page, $limit)->get();
     foreach ($rating as $ratings) {
         $ratings->winery = Winery::where('id', $ratings->wine->winery_id)->first()->toArray();
         if ($ratings->wine->image_url != null) {
             $ratings->wine->image_url = URL::asset($ratings->wine->image_url);
         }
         if ($ratings->wine->wine_flag != null) {
             $ratings->wine->wine_flag = URL::asset($ratings->wine->wine_flag);
         }
     }
     $data = $rating;
     $this->assertEquals(array("code" => ApiResponse::OK, "data" => $data->toArray()), json_decode($response->getContent(), true));
 }
开发者ID:anht37,项目名称:winelover_server,代码行数:19,代码来源:GetRatingMyWineTest.php


注:本文中的URL::asset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。