Questions tagged as 'laravel-5'

1
answer

Convert SQL query to Eloquent Laravel 5.6

I have the following SQL query to get grouped and ordered by months the sum of prices of three products, which makes no problem SELECT name, SUM(precio) AS total, mes FROM productos GROUP BY mes ORDER BY mes DESC; The result I get is...
asked by 28.06.2018 / 02:49
1
answer

Error: Argument 1 passed to Illuminate \ Database \ Eloquent \ Model :: fill () must be of the type array

I want to update the record in a single field of the table using ajax in the following way: $('#cerrar').click(function(){ var registro=$('#cerrar').val(); var route="http://127.0.0.1:8000/almacen/compras/"+registro; var token=$("input[na...
asked by 10.05.2018 / 23:44
1
answer

Call to a member function setCookie () on null

Good afternoon, I am using Laravel 5.6 and I have just applied middleware to my routes, it does the filtering in the following way: public function handle($request, Closure $next) { $tipoUsuario=$this->auth->user()->id_role;...
asked by 17.05.2018 / 19:59
2
answers

How to pass a variable from one function to another in laravel?

Best regards, colleagues, I have the following doubt regarding this, suppose I have the following functions in one of my controllers: public function DatosEstudio(Request $request){ $ConsultaActividades=DB::table('actividades')->select('no...
asked by 29.04.2018 / 20:37
1
answer

Debugge eloquent queries in laravel

I make transactions with eloquent de laravel 5.5 and I would like to debug the real query for example: objeto::all(); and I would like to see the real query for example select * from objeto in the same way for insert and update     
asked by 08.05.2018 / 16:55
1
answer

Pass a variable to a view with laravel 5.6

Good evening I'm using laravel 5.6, and I have a doubt I want to pass a variable to my view in order to use it and help me define whether or not to insert a form in view in the controller I have the following code: public function listar($dato...
asked by 24.05.2018 / 01:22
1
answer

Hide forms in Laravel 5.5 only visually

I am doing a project in Laravel 5.5. I have the following form to edit a post: The idea is that the only forms that the user can see are the notes and the description. The rest of the other fields will already have a value in the database...
asked by 16.04.2018 / 05:06
1
answer

I do not redirect routes

Do this controller in laravel: <?php namespace App\Http\Controllers; use App\Http\Requests\CreateUsersRequest; use App\Http\Requests\UpdateUsersRequest; use App\Models\Users; use App\Models\Roles; use App\Repositories\UsersRepository;...
asked by 16.04.2018 / 21:25
1
answer

inner join and left join in Eloquent Laravel

Assuming we have the following table structure in a database USERS TABLE MariaDB [blog]> describe users; +--------------+--------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | D...
asked by 17.08.2018 / 03:23
1
answer

Error Base table or view already exists: 1050 Table 'users' when migrating Laravel 5.5

I find an error when performing the migration in Laravel 5.5 This is the code of my migration file: <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migratio...
asked by 18.08.2018 / 07:07