laravel

Laravel 5.2, Maximum function nesting level

青春壹個敷衍的年華 提交于 2021-01-29 03:03:24
问题 Please, help me to find what is going on. I just set up a basic Laravel project. It's a new fresh Laravel project (5.2.29) This is route.php Route::get('/', 'TestController@index'); This is the test controller class TestController extends Controller { public function index() { return view('home'); } } The home.blade.php is the one that comes with a fresh Laravel installation, the one printing "Laravel 5". When I add the 'web' middleware, as following Route::group(['middleware' => ['web']],

How to use time format excel cell in laravel uploaded excel?

こ雲淡風輕ζ 提交于 2021-01-29 02:53:32
问题 i am using laravel package maatwebsite/excel version 3.1 for excel file upload. $collection = Excel::toCollection(new UsersImport, storage_path('app/' . $newFile)); i have uploaded a file where the format of cell is time. Here time in and time out cell has time format. when i upload this file the resulting output is: in resulting output time in and time out cells data is converted into string. how to prevent this from converting or how to change this from text to time? 回答1: You need to

How to use time format excel cell in laravel uploaded excel?

一个人想着一个人 提交于 2021-01-29 02:45:36
问题 i am using laravel package maatwebsite/excel version 3.1 for excel file upload. $collection = Excel::toCollection(new UsersImport, storage_path('app/' . $newFile)); i have uploaded a file where the format of cell is time. Here time in and time out cell has time format. when i upload this file the resulting output is: in resulting output time in and time out cells data is converted into string. how to prevent this from converting or how to change this from text to time? 回答1: You need to

InvalidArgumentException in Carbon::createFromDate()->age

流过昼夜 提交于 2021-01-29 02:41:52
问题 Hello i'm writing a custom validation for input data in my laravel project. I'm using Carbon::createFromDate()->age in order to get user age and check whether he's 16 or more. I reckon i'm not doing it properly because i get InvalidArgumentException with such errors: The separation symbol could not be found The separation symbol could not be found A two digit minute could not be found Unexpected data found. Trailing data $rok is a year(1996 eg.) $miesiac is a month and $dzien is a Day. Pesel

How does one get properties from related table as properties of it's own table in Laravel 5?

微笑、不失礼 提交于 2021-01-29 02:06:21
问题 The question might sound a little bit confusing but I don't know how to explain it better in one sentence. This describes basically what the problem is: I have a Users table which can contain 2 types of users. I know how I can separate by role. But here's the thing, users with role 1(editor_in_chief) have different attributes than users with role 2(reviewer). My idea was to create a table named 'reviewer_attributes' and 'editor_in_chief_attributes' and create a one-to-one relation with this

Sum of rows and groupby using eloquent

笑着哭i 提交于 2021-01-28 22:28:32
问题 Having the following columns: category, rating, num_users, date_voted /*number of users*/ How do I get the rating grouped by category as the sum of the number of users over a given range of dates using eloquent Category::groupBy('num_users') //returns the categories Example of the Main table data -------------------------------- category| rating| num_users| date_voted --------------------------------------- Action |5 |2 | 12-12-2015 Comedy |2 |2 | 12-12-2015 Fantasy |3 |2 | 12-12-2015 Action

More info about this question album-photo laravel gallery. error on updating photos in an album

女生的网名这么多〃 提交于 2021-01-28 22:16:00
问题 Danny Gitonga asked re: album-photo laravel gallery. error on updating photos in an album I am trying to accomplish the same thing and have the same problem. Saly 3301 answered, as I am a beginner with Laravel I don't quite understand the answer, could someone elaborate please, perhaps give more details. This is the youtube video https://www.youtube.com/watch?v=iXYCnYRalaw If you fastforward to the 1hour 15 minute part that is where my problem occurs. I hope it ok to link, saves a lot

Order By on HasMany relationship Laravel 5

蓝咒 提交于 2021-01-28 22:06:02
问题 In my Laravel 5 app, I've got a one-to-many relationship between two models. My models are: User and Message . I can access to messages from one user with: $messages = $user->messages How can I order these messages by creation date? Thanks 回答1: Following should work. $messages = $user->messages()->orderBy('created_at')->get(); 来源: https://stackoverflow.com/questions/31366694/order-by-on-hasmany-relationship-laravel-5

Order By on HasMany relationship Laravel 5

拜拜、爱过 提交于 2021-01-28 22:00:38
问题 In my Laravel 5 app, I've got a one-to-many relationship between two models. My models are: User and Message . I can access to messages from one user with: $messages = $user->messages How can I order these messages by creation date? Thanks 回答1: Following should work. $messages = $user->messages()->orderBy('created_at')->get(); 来源: https://stackoverflow.com/questions/31366694/order-by-on-hasmany-relationship-laravel-5

Laravel Passport suddenly returning 401 on Vue/Axios API calls

南楼画角 提交于 2021-01-28 21:55:37
问题 My application has an API that I consume from my JavaScript/Vue front end. Recently, I (unrelated) tried to unsecure Valet in order to share the site to perform webhook tests. I received a Brew 'Unable to determine linked PHP' error. Long story short I restored the symlink, updated composer dependencies and resecured Valet to ensure nothing was broken. Upon loading my application, all calls to my Laravel Passport secured API are returning 401. My unit tests are all passing, so the non