laravel-5.2

In Laravel 5, What's the difference between {{url}} and {{asset}}?

混江龙づ霸主 提交于 2019-12-30 01:54:15
问题 I find sometimes both is OK? So what's the really difference? For example, <link rel="stylesheet" href="{{asset('resources/views/admin/style/css-ui.admin.css')}}"> and <link rel="stylesheet" href="{{url('resources/views/admin/style/font/css/font-awesome.min.css')}}"> these two form is both OK. So, what's the differences? 回答1: Deciding which URL helper to use Consider the type of URL that is needed / how the URL is being used. One of the advantages of having separate helper methods for each

Laravel 5.2 Missing required parameters for [Route: user.profile] [URI: user/{nickname}/profile]

安稳与你 提交于 2019-12-28 02:52:27
问题 I keep getting this error ErrorException in UrlGenerationException.php line 17: When ever any page loads and I'm logged in. Here is what my nav looks like @if(Auth::guest()) <li><a href="{{ url('/login') }}">Log In</a></li> <li><a href="{{ url('/register') }}">Sign Up</a></li> @else <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ Auth::user()->nickname }}<span class="caret"></span></a> <ul class=

Route Issue in Anchor Link in Laravel 5.2

折月煮酒 提交于 2019-12-25 18:19:58
问题 I have route defined in the Route.php file like below Route::get('/SubCategories-List/{categoryID}', 'Skills\Category_Controller@SubCategories'); Below is the code done in Blade for showing list of records. @foreach($Categories as $Category) <tr class="odd pointer"> <td class=" last"> <a href="{{Route('SubCategories-List', [$Category->CategoryID])}}"> Sub Categories </a> </td> </tr> @endforeach I am getting the following error when action method calls the blade Route [SubCategories-List] not

laravel 5.2 Call to undefined method Illuminate\Database\Query\Builder::associate()

 ̄綄美尐妖づ 提交于 2019-12-25 18:06:01
问题 I am using laravel 5.2 and I am getting this error while creating user. Call to undefined method Illuminate\Database\Query\Builder::associate() this is my User.php namespace App; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { protected $fillable = [ 'name', 'email', 'password', 'role_id' ]; protected $hidden = [ 'password', 'remember_token', ]; public function role() { return $this->hasOne('App\Role'); } } my role.php namespace App; use Illuminate

laravel 5.2 Call to undefined method Illuminate\Database\Query\Builder::associate()

╄→гoц情女王★ 提交于 2019-12-25 18:04:25
问题 I am using laravel 5.2 and I am getting this error while creating user. Call to undefined method Illuminate\Database\Query\Builder::associate() this is my User.php namespace App; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { protected $fillable = [ 'name', 'email', 'password', 'role_id' ]; protected $hidden = [ 'password', 'remember_token', ]; public function role() { return $this->hasOne('App\Role'); } } my role.php namespace App; use Illuminate

laravel 5.2 Call to undefined method Illuminate\Database\Query\Builder::associate()

牧云@^-^@ 提交于 2019-12-25 18:04:12
问题 I am using laravel 5.2 and I am getting this error while creating user. Call to undefined method Illuminate\Database\Query\Builder::associate() this is my User.php namespace App; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { protected $fillable = [ 'name', 'email', 'password', 'role_id' ]; protected $hidden = [ 'password', 'remember_token', ]; public function role() { return $this->hasOne('App\Role'); } } my role.php namespace App; use Illuminate

Selecting entries whose `date_field < NOW()`

喜欢而已 提交于 2019-12-25 15:29:11
问题 When I try to run the following query, it returns nothing: Item::where(\DB::raw('date_field < NOW()'))->get() The reason for this is, that is null is appended to the generated MySQL query like this: SELECT * FROM items WHERE date_field < NOW() is null; Why does the is null part get appended to the above query? 回答1: This is a known issue in Laravel and has been reported on their GitHub page. Use whereRaw() instead and pass a string: Item::whereRaw('date_field < NOW()')->get() 回答2: No idea why

How to handle oauth2 and csrf token laravel

☆樱花仙子☆ 提交于 2019-12-25 09:26:11
问题 I installed Laravel 5.2 and oAuth2 Server Laravel in my project. I have to use same function for web-site and web-api. For web-site my function is working properly but when I use same function for web-api shown error TokenMismatchException in VerifyCsrfToken.php line 67: . My Route /* for web*/ Route::post('admin/user_login', 'Auth\AuthController@authenticate'); /* for mobile api */ Route::group(['prefix'=>'api/','before' => 'oauth'], function() { Route::post('/user/login', 'Auth

How to create custom pagination link?

核能气质少年 提交于 2019-12-25 09:13:25
问题 Right now i have this link on paginate : www.test.com/search/filter?page=1 www.test.com/search/filter?page=2 and what i want is this: www.test.com/search?search=&page=2 and so on Right now i have this: {!! $properties->appends(['toggle' => Request::get('toggle'), 'search' => Request::get('search')])->render() !!} How can i change this to have route like this what i want? i found this: Route::get('users', function () { $users = App\User::paginate(15); $users->setPath('custom/url'); // }); But

laravel 5.2 search query

我是研究僧i 提交于 2019-12-25 09:05:44
问题 Here is the most recent problem I have ran into. I'm trying to implement search into my application and I know how to do it when it comes to searching your tables for keywords with where('firstname', 'LIKE', %$search%) and such. However, how would I go about narrowing down a search based on what criteria the user specifies. For exlample search for $keyword but also a $city and $pricePoint. I'm just trying to figure out how to structure the query in php so that if user specifies the $keyword