Questions tagged as 'laravel'

1
answer

Can I use select in relationship in laravel?

I have a model that takes the data with a with in laravel, to get correlated data, is there form of this correlated data to see only some specific fields and not all the data in the table? I tried to do so: return ModelPai::with(array('nome...
asked by 19.10.2017 / 14:27
1
answer

Nested Middlewares

I'd like to allow access to a few pages only if the user is logged in. I did so: Route::group( ['middleware' => 'usuario'], function (){ /* Minhas páginas */ }); So far so good, but I'd like to check if the password is already the...
asked by 29.11.2017 / 19:54
2
answers

How to handle QueryException error SQLSTATE [23000]: Integrity constraint violation: 1062 Duplicate;

The id is auto increment, but the id_uc is unique, just not to enter an id_uc equal. I want you to return to view a message. $storm =new ListaStorm(); $storm->id = $id; $storm->id_uc = $id_uc; $storm->save(); error message? @fore...
asked by 28.09.2017 / 23:47
2
answers

Print a sum in the view

MySQL WorkBench    ErrorException Array to string conversion public function listadepontos() { $id = auth()->user()->id; $somas = DB::SELECT("select SUM(pontuacao) FROM palpite WHERE id_u = '$id' "); return view('pontu...
asked by 29.09.2017 / 03:07
1
answer

MySQL Error - Stored Procedures

I'm creating this procedure to run once a day, as I have no experience, I got an error in the code below: CREATE (definer omitido) PROCEDURE 'MULTAOFF'() BEGIN set @multado = (select 'CPFAluno' from multa where 'dataMultaFim' &l...
asked by 07.11.2017 / 13:22
1
answer

Define sender name using ResetPasswordNotification

I am using Notification in Laravel to send password reset emails. My toMail method looks like this: public function toMail($notifiable) { return (new MailMessage) ->subject('Link para redefinição de senha')...
asked by 02.10.2017 / 01:09
1
answer

Use sum with Eloquent

I have the following query: SELECT P.ID ,P.NR_CRACHA CRACHA ,P.NM_CLIENTE NOME ,E.DS_EMPRESA EMPRESA ,SUM( R.VL_PRECO ) VALOR FROM registro R JOIN pessoa P JOIN empresa E WHERE P.CD_PESSO...
asked by 24.11.2017 / 18:00
1
answer

Images do not appear in the Mail inbox. Laravel 5.4

There is a contact form where the user sends a message to the system and the system automatically sends a message back thanking their contact and along with the message I send the most viewed articles. What happens is that in my hotmail (in my m...
asked by 10.10.2017 / 04:01
1
answer

Pagination in laravel 5.5

I'm performing a pagination of the data as follows: Controller: $brands = $this->brand::where('id', $filter_id)->paginate($this->total_page); View: {{ $brands->appends(['id' => isset($filter_id) ? $filter_id : ''])->l...
asked by 09.10.2017 / 21:08
1
answer

Laravel / Eloquent - Query on more than one table

I have the following Tabelas/Models and I am not able to make a query: Model 1 id | Name ---+--------------- 1 | Model1.1 2 | Model1.2 3 | Model1.3 Model 2 id | Name | model1_id ---+----------+---------- 1 | Mode...
asked by 07.10.2017 / 21:33