laravel-5.5

Laravel Eloquent: How to use whereDate with Between?

南楼画角 提交于 2020-01-03 13:30:12
问题 I am using Laravel 5.5, I need to form a query where only date part of a datetime column should be matched, equivalent of date(date_col)='2018-01-01' kind of thing. How do I achieve this in Eloquent way? WhereDate() returns date part but is there some way to merge both? Thanks 回答1: For merging whereDate and between you can use something like this: User::whereBetween(DB::raw('DATE(created_at)'), array($from_date, $to_date))->get(); sql : select * from `users` where DATE(created_at) between

Visual Studio Code can't find files inside vendor folder (Laravel project)

て烟熏妆下的殇ゞ 提交于 2020-01-03 08:07:12
问题 I'm working with Laravel 5.5 and I use Visual Studio Code for code editor. After last update, VS Code freaked out. The main problem is that I can't search files inside vendor folder with ctrl+p. I can search and find any files except inside vendor folder. Does vendor folder disallow searching? I can't find anything related to this. Does anyone have a similar problem? Thanks! 回答1: Fix 1 . I am not sure how many projects you have but I think you can enable this by changing the excludefile

Laravel Eloquent query build select min value

旧城冷巷雨未停 提交于 2020-01-03 05:37:16
问题 I am having the following query (trimmed) to list the rooms to user for booking: $buildquery=Room:: with(['hotel' => function ($query) { $query->where('status', 0); }]) ->with('image')->with('amenities'); if ($request->filled('location_id')) { $buildquery->Where('city', $request->location_id); } $buildquery->Where('astatus', 1)->Where('status', 0); $rooms = $buildquery->simplePaginate(20); Actual query (not trimmed): select `rooms`.*, (select count(*) from `amenities` inner join `amenities

Laravel 5.5 - Validate Multiple Form Request - at the same time

坚强是说给别人听的谎言 提交于 2020-01-03 02:22:07
问题 The question is already asked here for a previous version of laravel and not yet answered. I have a html form which is validated using three different Form Request Validations . I am able to do this. But, the problem is, the form validations take place one by one. Not at the same time. If the first form request throws a validation error the form is returned to the view so rest of the two forms doesn't evaluated, hence a proper validation error can't be displayed to the user. What I want is :

Laravel 5.5 - Validate Multiple Form Request - at the same time

怎甘沉沦 提交于 2020-01-03 02:22:06
问题 The question is already asked here for a previous version of laravel and not yet answered. I have a html form which is validated using three different Form Request Validations . I am able to do this. But, the problem is, the form validations take place one by one. Not at the same time. If the first form request throws a validation error the form is returned to the view so rest of the two forms doesn't evaluated, hence a proper validation error can't be displayed to the user. What I want is :

Laravel passport refresh token

三世轮回 提交于 2020-01-01 12:20:08
问题 I am using a Laravel version 5.5 using Passport for authentication. I have successfully create the token and can access it using the auth:api middleware. But whenever user login into system it create new token for that user. I just want to refresh user last token and send it back instead of creating a new token. I have used the following code to generate auth token $token = $user->createToken('string-'.$user->id)->accessToken; It generate the token with 1075 characters but when i checked in

Laravelcollective/html not working in Laravel 5.5

时光总嘲笑我的痴心妄想 提交于 2020-01-01 12:12:09
问题 I've tried to use the Laravelcollective/html on laravel 5.5 by loading the v5.4 in my composer.json file but that didn't work. This is the code in the composer.json file: "laravelcollective/html":"^5.4.0", and loading it into my app configuration file app.php : inside the providers array Collective\Html\HtmlServiceProvider::class, But after i used the blade code to create the form it didn't work, here's the blade code. {!! Form::open(['route' => 'posts.store']) !!} {{Form::label('title',

Laravel 5.5 The page has expired due to inactivity token is present

为君一笑 提交于 2019-12-31 07:23:09
问题 I just deployed my laravel app on shared hosting with php 7.2. App is working fine on DigitalOcean and on my local Homestead. But when hosting on shared hosting with php7.2 /opt/alt/php72/usr/bin/php -v PHP 7.2.5 (cli) (built: May 2 2018 05:43:40) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.1.0, Copyright (c) 2002-2017, by ionCube

Laravel Authentication - Username and Password in different tables

China☆狼群 提交于 2019-12-31 05:29:28
问题 getting problem with authentication in laravel as I have username and password in different tables.As Auth uses same table for username and password but my database is already setup where the the username is in table users and the password is in table webpages_membership, and I cant change the database structure because that database is used by other mobile application and website too. So how do I use Auth for login system. @btl: I tried the solution but now there is another error of

Save data from table rows in laravel

冷暖自知 提交于 2019-12-24 18:13:16
问题 I have multiple input fields with same name in a page when i try to save i throws an error.how should i save data from multiple table row data into database. the error Creating default object from empty value at here $varientaccesss->variant_id = $request->input('varient'), Controller public function storevarient_update(Request $request) { //return $request; $varientprice = new Price(); $varientprice->variant_id = $request->input('varient'); $varientprice->discount = $request->input('discount