Questions tagged as 'laravel'

2
answers

How to use Laravel's delete route?

I have the following route: Route::delete('/{id}', 'PessoasController@delete'); But with the following form I can not access the route: <form action="/45" method="DELETE"> <button type="submit">Deletar</button> </fo...
asked by 13.01.2017 / 15:35
1
answer

Get the logged in user id

How do I get the id of the logged in user and insert it in the table along with description and title? I imagine it to be quite simple. public function saveCallRegister() { $title = Request()->input('title'); $description = Reques...
asked by 24.04.2018 / 19:31
4
answers

Get the first 2 user names

Let's say the name of my selected user is " Raylan Soares Campos ", how do I display only the first two names? In the case " Raylan Soares ". I'm using laravel 5.2, I do not know if I have a facilitator or if I have to do a function manually,...
asked by 30.06.2016 / 22:46
1
answer

What is the correct way to pass data from the view to the model?

Using Laravel, what is the best way to pass data from view to model? For example, forms data and etc ... Some time ago I used Codeigniter and sent the data via ajax. In the case of Laravel, would it be the same, or do you have any better and...
asked by 17.11.2015 / 19:13
3
answers

Error with complementary routes in Laravel 4

Initially, I created the following route (1st search): Route::get('/buscar/profissoes/{city_id_slug?}', array('as' => 'neighborhoods.city', 'uses' => 'NeighborhoodsController@getIndexCity')); Then the URL looks like this at the e...
asked by 17.12.2013 / 12:11
3
answers

Duplication of code in Laravel ORM

I was working and I came across the following situation: if (($entrada == null) and ($parcela == null)) { $cotas = Produto::orderBy('credito', 'DESC') ->where('id_subcategoria', $subcategoria) ->where('visivel_site',...
asked by 04.01.2019 / 19:18
3
answers

Calculate difference between two dates - I can not convert the date of the database to DateTime

Good afternoon! I made a function to calculate the difference of days between two dates, one of these dates is the current one (which I create using new DateTime() ) and the other one gets in the database and is saved as dateTime fore...
asked by 26.03.2017 / 19:38
1
answer

Where it takes a long time

I'm using Laravel 5.6 My model is normal <?php namespace App; use Illuminate\Database\Eloquent\Model; class MyTable extends Model { protected $table = 'myTable'; public $timestamps = false; } I'm trying to make a simple qu...
asked by 25.09.2018 / 22:22
2
answers

How to count the total of records in a query with limit and offset?

In a query with paginate I would use total() in view to return total records. Using limit and offset can not do this, is there an alternative that does not involve just making a new query just to count? / p> $comentarios = $t...
asked by 15.12.2017 / 15:16
3
answers

Eloquent with does not do inner join?

I remember the old "find" that in a query using Eloquent, if I used with Laravel made a inner join . Today I happened to check the queries of a project and ... [2014-11-20 23:21:16] sql.INFO: select * from 'ocurrences' where 'o...
asked by 21.11.2014 / 00:35