Questions tagged as 'laravel-eloquent'

1
answer

Laravel - How to call a different action from store, update, edit?

I created a action but not the default of resource , as I can call it by an action in form as I call update and store . <form method="POST" role="form" action="{!!URL::route('cadastro.store')!!}" > I w...
asked by 02.12.2016 / 00:16
1
answer

LEFT JOIN with AND at Eloquent Laravel 5

I have a query with Left Join with AND I am not able to implement this in laravel 5. An excerpt from the query: LEFT JOIN visitante v ON a.codigo = v.id AND v.data BETWEEN '2015-06-01' and '2016-05-31' and v.status = '1' I tried this wa...
asked by 25.11.2016 / 15:38
1
answer

Picking up monthly items ELOQUENT MODEL

Well I need to make a query where I have to bring all the listed items of the month we are in. In query that I've done I'm bringing all with status co_de O : $vendas = Encomenda::where('FlgStEncomenda', 'O')->c...
asked by 11.11.2016 / 15:09
1
answer

How to get the result of the query executed in Eloquent?

How do I get the result of query that will be executed in the database? Example: foreach ($prestadores as $prestador){ $achou = \DB::table('modulo_pr_espelho') ->where('prestador_id','=', $prestador->id)...
asked by 14.11.2016 / 21:44
1
answer

Self-relationship with Eloquent in Laravel 5.3 [duplicate]

I am building an immigrant control application and own an imigrants table that has 3 auto relationships. Its structure is as follows. id - > pk first_name - > varchar last_name - > varchar (...) father - > integer (fk)...
asked by 26.12.2016 / 17:45
1
answer

Laravel Much to Many?

I have this model public function exercicio() { return $this->belongsToMany(Exercicio::class); } and public function treino() { return $this->belongsToMany(Treino::class); } My Controller public function salvarTreino(Re...
asked by 15.10.2016 / 00:30
1
answer

How to do inner join within Auth in laravel 5.3

In the default migration that Laravel brings to use Auth , I made a ForeignKey with another table by calling the ID. For better understanding I put here the tables and with the following columns: Plants (table) ID | Nome (colunas...
asked by 29.09.2016 / 17:36
1
answer

Infinite relationship ...? [closed]

I have a doubt that would be, how to conduct a relationship that can be infinite: Ex: User table with the user id field that would be one for many with Post Table. Inside the Post Table would have post_id that would have more post inside i...
asked by 13.12.2018 / 18:57
1
answer

Creating Foreign Keys by Migration - Laravel

I'm having trouble when I try to create foreign keys for Migration in Laravel. Look at my Migration !!! <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreateEmpresaUsuarioTable exten...
asked by 22.06.2014 / 02:37
1
answer

Change column names used to save timestamp

When storing or editing data in a table by laravel it creates a timestamp that uses the created_at and updated_at But I have to store the data in a table shared with another system, and it uses another nomenclature to st...
asked by 13.11.2017 / 17:00