Questions tagged as 'laravel-5'

2
answers

Laravel 5 QueryBuilder, results in simplified collection

I'm using the get() method of Laravel's QueryBuilder and would like to know if it's possible to return the id's in a simple one-dimensional array, for example: [35,45] Instead of: [{"id":35},{"id":45}]     
asked by 15.07.2016 / 15:17
1
answer

How to bring only the latest records with Laravel 5.2

I need to return the last 10 records for a view .. return view('home.home', [ 'data' => $this->sale->get(), //aqui eu quero pegar os 10 últimos 'nav' => 'dashboard' ]); Is there any Eloquent method that does this?     
asked by 20.10.2016 / 15:59
1
answer

How to use the Laravel Excel Library

I have a .csv where I need to import your data into the database. To do the import I'm using a Laravel library. What's in here: link In the code I'm doing this: <?php namespace App\Http\Controllers; use App\Http\Requests; us...
asked by 10.08.2015 / 22:45
1
answer

What is the difference between Request :: wantsJson () and Request :: ajax ()?

In Laravelle 4, I used to use the Request::ajax() method to know and the request was an XHR. When I started using Laravel 5, I realized that I was being used more in the tutorials than Request::wantsJson() . However, I noticed th...
asked by 13.07.2018 / 17:41
2
answers

Perform action before saving?

I'm getting the requests of the form and putting it all at once to save it using Laravel% co I'm getting this way: public function save(Request $request) { $user = new User( $request->all() ); $user->save(); } The...
asked by 22.11.2018 / 14:03
1
answer

Advanced search in Laravel 5

I'm starting at Laravel 5 and as learning I'm creating a simple employee's register. What I need is to retrieve from the bank an employee relationship with surveys based on search conditions. In the example below, I used When to...
asked by 24.06.2017 / 13:47
1
answer

Auth laravel error with another model?

Personally I changed the default model name of Laravel User.php to Colaboradores.php (of course, I set the $table and $primaryKey in the model), I also changed the config/auth.php to model . but login is...
asked by 21.05.2017 / 00:12
1
answer

Use Auth class in configuration file in Laravel

I'm using barryvdh / laravel-elfinder . This generates the configuration file /config/elfinder.php. Within this file, I inform the way to upload ElFinder files. I need every user to have their upload folder. I thought of creating a...
asked by 31.10.2016 / 17:56
3
answers

Foreign keyless database in Laravel

I attended a class where a stock system is created in Laravel where the product and the category exist. But there is no foreign key, only a category_id column. How is this relationship made? Is this relationship in the application?     
asked by 08.11.2016 / 17:45
1
answer

Asynchronous pagination with laravel

I made a simple pagination with laravel using the ->paginate() return, but as you know, it's not an asynchronous action, which leaves bad paging. I found some examples, but I could not make it work. Does anyone have tips?   ...
asked by 07.12.2016 / 13:36