Questions tagged as 'laravel-eloquent'

0
answers

Select column when importing Excel file into Laravel database

I need to make a resource in an application using Laravel. When giving an Excel spreadsheet allow the user to choose which columns to save to the database. Example: I have a spreadsheet with 3 columns, but I just want to select (use some way to...
asked by 27.06.2018 / 15:08
0
answers

Average sales ticket using AVG Laravel

I'm trying to calculate the average sales value of a store, but I'm having some problems calculating the total value of each sale, Controller: $valor_total = PedidoProdutos::with('valor_por_pedido')->get(); Model: use Illuminate\Data...
asked by 07.07.2018 / 15:51
0
answers

Parameter query sql

I have the following function and would like to use the following parameter method public function graficos( Request $request ){ $id = $request->input('id'); $query = "SELECT * FROM tabela WHERE id = :id OR id = (SELECT...
asked by 25.06.2018 / 21:56
0
answers

Relationship at Laravel

Talk about it, I'm starting to use laravel and I have a problem when selecting some data. I have the following tables: users , jobs , projects , job_user . The table relationship of users and jobs is...
asked by 12.06.2018 / 03:39
0
answers

Count several records for the chart in Laravel

How do I count multiple records with Laravel? Example: Table homicios, count the columns mes, date, city separately and generate the graph in the chart. Chart 1: Jan - X amount Feb - X amount Etc Chart 2: City A - X amount City Z - X quant...
asked by 27.05.2018 / 14:32
1
answer

How can I get information using laravel with chained join?

I have 3 layers of entities, of which I only want the third object. but based on information from the first two. For example, I have a factory that makes cars, and each car has a type of wheel. I want all the wheels manufactured by a factory....
asked by 01.06.2018 / 13:19
1
answer

Search merge Laravel

I have the function in my controller: public function pesquisa(Request $request) { if (! Gate::allows('celular')) { return abort(401); } $marcas = CelularMarca::orderBy('nome', 'asc')->pluck('nome','...
asked by 15.05.2018 / 19:20
0
answers

Notifications same as facebook for PHP

What is the best way to develop notifications that work just like Facebook when someone has a post? I am using PHP & Laravel 5.5. Does anyone know or have seen this in Angular / VueJS / Javascript?     
asked by 17.05.2018 / 15:51
0
answers

method detach () deleting data over

My method detach deletes all data from the student table (it removes the data from the membership table but deletes all data from another table) $team = Team::find($id); $team->students()->detach(); $team-&g...
asked by 02.05.2018 / 01:55
1
answer

How to use nested loading nested in Laravel 5.4 correctly? my related tables return "null"

I have the following search in my application: $results = Profile::with('profileCategories.categories', 'informations')->where('ativo', '=', "1")->where('nome', 'like', '%' . $request->search . '%')->orWhere('sobre', 'like', '%...
asked by 21.04.2018 / 03:25