Questions tagged as 'laravel-5.5'

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
3
answers

What is the correct way to pass two or more parameters on the route?

I'm trying to pass two parameters in the route, however, I get this error:    "Route pattern" / tab / {id} / client / {id} "can not reference variable name" id "more than once." The route used: Route::get('/visualizar/{ficha_id}/{client...
asked by 28.11.2017 / 16:11
1
answer

Divide sum and count result into the same Query?

The code below works, but I wanted to know how to do it all right in query , and if the way I'm setting it up is really the best way. $query = Avaliar::select(DB::raw('COUNT(id) as contar'), DB::raw('SUM(nota) as total')) ->where('...
asked by 19.12.2017 / 05:14
1
answer

Sending application files to the API

I have a React-native APP and an API with Laravel The two are communicating correctly, sending APP data to the API and otherwise incorrectly At the moment to send and receive requests in the APP I use axios But now I would like to...
asked by 22.12.2017 / 18:27
1
answer

Laravel 5.5: WhereHas in relationship many to one

From what I understand in the documentation, where whereHas works, you need to have a get at the end of the query , however I need to use first , since I'm getting information from a particular record. The way the code is, it does not disp...
asked by 20.12.2017 / 13:15
1
answer

Save files with storeAs outside the Storage folder

I have a API in Laravel a file store $request->file("file$i")->storeAs('categories', $nameFile) As it stands it stores the data correctly in the address /var/www/html/apiapp/storage/app/public/categories But I would like to sav...
asked by 04.01.2018 / 19:45
1
answer

Form :: select Laravel

I'm having a hard time making a Form:select that fetches information from the database. How is Controller ; public function create() { return View('internos.create'); } As it is in View ; <div class="form-...
asked by 17.12.2018 / 18:54
1
answer

How to create the programming logic to disable a button after an action?

Context: Home Approval data will only be saved if there is a saved amendment, the 'save' button should be disabled at first. When you save the amendment the 'save' button is disabled and your approval data will be saved. But how to d...
asked by 30.08.2018 / 22:09
1
answer

Laravel 5.5: Get name of each table in select union

I need to make a select in two tables and join them with union , until then, but I need to also get the name of the two so I can identify it in View . > I have tried to use getTable() in each select , but it returns the e...
asked by 23.12.2017 / 22:37
1
answer

How to check if the user is logged in VueJS + Laravel 5.5?

I am following a course in Laravel 5.5 + VueJS, and putting into practice what is being taught. However, it does not address authentication at the moment, and since I'm designing the entire project to load your content with VueJS, it's getting a...
asked by 05.11.2017 / 23:14