Laravel validation rules for related checkboxes

In my form I have a couple checkboxes and i want at least one of them (or both) to be checked before submitting my form. My input checkboxes are named car and bike. In my controller i am validating my request $this->validate($request, [ ...
more »

2017-04-22 19:04 (1) Answers

Collection is empty

So I'm basically trying to retrieve all "favourites" for a specific user from the pivot table favourite (yes it seems that I started my project by misspelling the word favorite). So when viewing u/Admin, I should be able to view all games admin has ...
more »

2017-04-22 16:04 (1) Answers

How to seed pivot table in Laravel 5.4?

I am following a tutorial called Incremental API in laracasts by Jeffrey Way. There is a different coding between Laravel 4 faker class seeding and laravel 5.4. I still followed the same code lines from the tutorials "Seeders Reloaded". Now, I am ...
more »

2017-04-22 04:04 (3) Answers

Redis keys are not expiring - Laravel, Predis

I am using Laravel 5.4, with Predis and the latest Redis (or Redis for Windows). The keys are being saved without issue. So, I doubt it's a configuration issue. The problem is that they are not expiring. The key is reused until it expires...similar...
more »

2017-04-21 20:04 (2) Answers

Laravel | ask password for certain actions

In my laravel 5.4 project there is a payment form upon submitting which I want to show a dialog asking the logged in user's password(for additional security). i.e I want the logged in user to enter his password when he wants to do some critical actio...
more »

2017-04-21 18:04 (2) Answers

How do I check if Bcrypt password is correct?

I was using md5 to hash my passwords but learned that using bcrypt was more secure. When using md5, it was easy to check whether a password entered in a form was correct. I simply done if(md5($request->password) == $user->password) //Login...
more »

2017-04-21 17:04 (2) Answers

Laravel pivot table null foreign key

Say that I have 3 tables: table1 +----+-------+ | id | name | +----+-------+ | 1 | some | | 2 | some2 | +----+-------+ table2: +----+-------+ | id | name | +----+-------+ | 1 | some | | 2 | some2 | +----+-------+ table1_table2: +---...
more »

2017-04-21 14:04 (1) Answers

Laravel routes/web.php and routes/api.php

The routes/web.php have common application routes, Like showing the views, Getting the data from the form to a controller method. The routes/api.php will have routes for getting records of the tables/entities in JSON. Updating, Deleting etc via api ...
more »

2017-04-21 14:04 (1) Answers

Laravel: Api.php in routes directory

I am a bit confused, I have a web application having a login, Register, Logout. Some dashboard views etc(CRUD), I want to make an api for this application too. Like an api which third party will use, Can update records, Can delete records etc. Ac...
more »

2017-04-21 11:04 (2) Answers

Larave list routes in the view

How can I list routes specifically the api routes in my view? For example These: ...api/user ...api/Information The artisan command for example does list them like this: php artisan route:list ...
more »

2017-04-21 10:04 (1) Answers

laravel slow query issue

I want to optimize my query I am executing with Laravel. I'm using MySQL for my project and I have a table named locations. It has more than 2 million records. When I execute the code below it's too slow. How can I optimize my query to improve the sp...
more »

2017-04-20 13:04 (2) Answers

Laravel Passport mobil app access

I built a Laravel Passport application. If I put the routes + the token in Postman it works perfectly fine, I get json data. Now what is the logic if an android application needs the access these json data. Does the android app need to successfull...
more »

2017-04-20 11:04 (0) Answers

diffForHumans for regular dates in Laravel

So on my website, I want to be able to tell when a job is due. I can print the date just fine, <p>Due in: {{ $active_commission->estimated_date }}</p> will give me "Due in: 2017-04-28" for example. Now, that's cool and all, but I...
more »

2017-04-20 11:04 (1) Answers

Pass @lang as @section parameter in Laravel

I am working on a Multi Lingual Application in Laravel 5.4 template.blade.php <title>@yield('title')</title> Then in other pages, I am trying to set the tile dyamically based on user locale. It throws error when I try to use the follo...
more »

2017-04-20 10:04 (2) Answers

Errors creating and getting model

This model is not behaving properly. It does not fill in its attributes, nor can I call find(), get(), or any kind of getter on it. Here is it's create_matches_table: public function up() { Schema::create('matches', function (Blueprint $table)...
more »

2017-04-20 07:04 (2) Answers

sending email after specific date

i am using laravel 5.2 i want to prepare an email to be sent after 50 days when the user click on a button then go to controller i found "later" method but i did not work, its sends the email immediately. also i found "scheduler" but i could not und...
more »

2017-04-19 22:04 (1) Answers