Questions tagged as 'laravel-eloquent'

2
answers

Laravel eloquent returning array array

I have this query using eloquent $data= \App\Logs::select('id', 'created_at') ->get() ->groupBy(function($val) { return Carbon::parse($val->created_at)->format('d-M-'); })->toArray(); and it retu...
asked by 07.07.2017 / 17:23
2
answers

Result field name instead of id in Laravel 5?

I have a relationship in Laravel but when I make an query comes the id and not the field name. Model Evento public function tipo_evento() { return $this->hasOne('App\TipoEvento','id','tipo_evento'); } Mode...
asked by 12.06.2017 / 18:35
1
answer

Many-to-many relationship Laravel 5

Good afternoon. I am developing a system in Laravel 5.3 with the following tables: From the commission id, I need to bring all the related data into a view where it will list in a table which parliamentarians are part (one per line), what is...
asked by 28.03.2017 / 14:32
1
answer

Dynamic list in alphabetical order?

Inside this array of my dynamic list , its content is returning in a disordered way, how do I put it alphabetically? <div class="form-group"> <label for="nome">Categoria do Produto</label> <select i...
asked by 17.01.2017 / 00:48
1
answer

Difficulties in creating update with Laravel 5.1?

I'm trying to create a update with Laravel 5.1 but it's bringing the following error:    Type error: Argument 1 passed to Illuminate\Database\Eloquent\Builder::update() must be of the type array, object given Follow my Cont...
asked by 14.02.2017 / 13:58
1
answer

Create aliases for columns in a table in Laravel

Is it possible to create aliases for the column names of a table in Laravel's Model? Example: I have a questao table with columns: id questao disciplinas_id serie_id professor_id It would be simpler if I could treat the columns by ot...
asked by 23.06.2017 / 13:13
1
answer

Multiply insert with laravel 5.3 dynamic form

I'm trying to make a multiple insert with Laravel 5.3 in a table as follows: Form {!! Form::open(['route' => 'demanda.store', 'class' => 'form']) !!} <div class="form-group form-inline"> {!! Form::label('ano',...
asked by 31.01.2017 / 21:22
2
answers

Laravel 5.3: Jump of auto_increment (id) (Gaps)

I did a basic CRUD using Eloquent. My problem is when it's time to create. I use the code below: public function store(Request $request) { $subscription = new Subscription; // Basic Data $subscription->custom_id = '10001';...
asked by 30.11.2016 / 19:16
1
answer

Relationship N: N in Laravel does not write object attributes

My tables briefly have the following structure: minutes: id | vigencia Products: id | nome | descricao ata_producto: ata_id | produto_id | vlr_produto | qtd_produto The same product may have different value depending on t...
asked by 13.09.2015 / 20:23
1
answer

How to concatenate value in a dropdownlist in laravel 5?

How to add the first default value in a dropdownlist? I tried to do this: {!! Form::select('Usuario.est_id',array('null' => 'Selecione') + $estados, null, ['class' => 'form-control']) !!} but I get the error: FatalErrorException in 30...
asked by 21.07.2015 / 23:53