I have the manyToMany relationship between Grupos and Usuarios and a pivot table grupo_usuario that stores the keys and an extra aprovador , Boolean field, which serves to indicate if the user in the relationship can...
At some point in my application I'm creating a post and relating it to the session user:
public function adicionar(CadEditPost $request)
{
$request->merge(['user_id' => Auth::user()->id]);
if(Post::create($request->...
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?
I have a big problem that I can not solve because I am still a beginner in Laravel. The problem is that I'm developing a web application and I need to list the cities object in two different select, however when I add the second foreach it gives...
My table is constituted as follows:
╔════════════════════════╗
║ USER ║
╠═══════════╦════════════╣
║ Id ║ Integer ║
║ Name ║ String ║
║ Address ║ String ║
╚═══════════╩════════════╝
I have some dat...
I have a relationship of One To Many , I wanted to know how do I access data from the two tables.
See:
Album::with('imagemAlbums')->where('departamento_id', $id)->get();
Return from dd()
Now in my View...
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...
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...
I'm doing a supplier registration, and I need to record it in one table and its address in another. I use a single view vendors.blade to fill in all the data. How can I separate this data to write them to their respective tables?
Suppliers...
I saw in the documentation of Laravel an explanation about the use of Eloquent. There I saw a part where you talk about Local and Global Scopes .
As I do not speak much English, I had some doubts about using it.
What are these methods w...