Questions tagged as 'laravel'

3
answers

How to sort the query in the same order as an array used in WhereIn?

I would like Laravel to return a list of products where the ID belongs to this array: [12,5,1,8,16] , but sort by id according to array order! * What I have so far: $produtos = Produto::whereIn('id', $ids) ->orderBy( adici...
asked by 05.12.2017 / 15:30
1
answer

What is the simplest way to do an IS NULL with Eloquent?

I saw tutorials on the internet that the way you had to make a IS NULL is as follows: Remessa::where('campo', 'IS', DB::raw('NULL'))->get(); But I was wondering about this, because if an ORM is usually developed thinking of creati...
asked by 04.05.2016 / 17:37
1
answer

What status can I return in an attempt to submit a form without a TOKEN?

I'd like to know what status http I should return in my application if someone is trying to forge a request via form. The application I developed is done in Laravel 4 and I'm using that CSRF_TOKEN . The CSRF_TOKEN...
asked by 13.02.2015 / 14:02
1
answer

Comparison of hours in Laravel

I'm trying to create a method that will return the amount of minutes since the last insertion in the database. The way I did it was this one, but this one giving error: $now = Carbon::now(); $minutes = LusLeadUpdateStatus::select('created_at')...
asked by 30.08.2018 / 21:38
3
answers

Auto Relationship with Laravel

I have the following problem when trying to make an auto relationship with Laravel 5. I want to make a user registration, where users can have other users linked, creating an authoring N x N, user_user; The user will have a status, and this s...
asked by 06.03.2016 / 19:45
1
answer

How to keep the data already filled in the input after submitting a form?

I'm using the PHP language and the Laravel Framework 5. In the validation of the form, if it contains some blank field or with sizes of characters not accepted, when clicking save the system shows the message of validation, however the fields th...
asked by 30.05.2016 / 05:50
2
answers

Laravel database connection error

Use mamp and set up the database.php file so 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localhost:8889'), 'database' => env('DB_DATABASE', 'estoque_laravel'), 'username' =&...
asked by 13.11.2015 / 17:52
1
answer

Automate tasks with Laravel 5

Good morning, people. I need to create some tasks on my system that run automatically (such as a Cron Job). Example: Every day the system sends an email to the customers of the system with the amount of their charges, and the ones that are cl...
asked by 09.03.2015 / 14:49
1
answer

Self-relationship in Group table with Laravel and Eloquent?

I have a table of grupo with the fields:    id ( int not null auto-increment )       description ( varchar )       groupid ( int null ) How would it be: 1) the migration corresponding to this table? 2) the creati...
asked by 24.09.2016 / 00:36
2
answers

On-to-one relationship in auxiliary table using Laravel

In the application I'm working the database is built on the users part, as follows: user 1 -------> 1 user_address 1 <-------- 1 address In the user table there is no column that references the address. What exists...
asked by 05.01.2016 / 07:33