0
I do not understand what is happening in this code that fills a cell B8 in excel:
$sheet->cell('BQ'.$i, function($cell) use($report) {
$cell->setValue(!empty($report->PastaStatusHistorical->where('status_historical.status','Concluído')->first()) ?
$report->PastaStatusHistorical->where('status_historical.status','Concluído')->first()->created_at->format('d/m/Y') : '');
});
A date is being passed from the database or application?
How do I find this table and column in the bank?
That one where->
indicates that there is a select?
created_at->
is a method?
What’s going on with PastaStatusHistorical
? I go in the template and do not find these status fields 'completed'.
Thank you very much, now in the model ta essa jossa here : public Function Pastastatushistorical(){ Return $this->hasMany('App Models Statushistoricalfolder', 'pasta_id'); } // I couldn’t leave it as a code ... can you explain to me what’s going on ?? Do I still have to go after this Historical Folder status, which is another model to understand what’s going on ? Hell, this hellhole has come to make someone’s life easier ??
– Victor Hugo
@Victorhugo, I edited the answer with an article in Portuguese about the relationship between tables, and about Laravel help, I think it helps a lot, once you understand the Eloquent ORM, you will hardly need to write some SQL code, and making the right relationships, you will never again do
INNER JOIN
in their consultations.– Dobrychtop