if don't wanna use the ip address
docker get IP address command:
docker inspect -f '{{range. NetworkSettings. Networks}}{{. IPAddress}}{{end}}' container_name_or_id
use host.docker.internal
if don't wanna use the ip address
docker get IP address command:
docker inspect -f '{{range. NetworkSettings. Networks}}{{. IPAddress}}{{end}}' container_name_or_id
use host.docker.internal
1. appsettings.json
namespace ReactAPIApp.Server.Models{public class Driver{public int Id { get; set; }public string Name { get; set; } = null!;public int DriverNumber { get; set; }}}
4. Add Context for example add Data folder
Data/ApiDbContext.cs
using Microsoft.EntityFrameworkCore;
using ReactAPIApp.Server.Models;
dbcontext command lines:
Add-Migration initial
remove-database
update-database
scopeSearch
collect(explode(' ', $terms))->filter()->each(function ($tiem)use ($query) {
$term = '%' . $term . '%';
$query->where(function($query) use ($term) {
$query->where('first_name', 'like', $term)
->orWhere('last_name', 'like', $term)
->orWhereHas('company', function($query) use ($term) {
$query->where('name', like', $term);
});
});
});
to SQL it is
SELECT * FROM 'users'
WHERE 'first_name' LIKE '%bill%'
OR 'last_name' LIKE '%bill%'
OR EXISTS (
SELECT * FROM 'companies'
WHERE 'users'.'company_id' = 'companies'.'id'
)
model/Comment.php
public function isAuthor() {// n + 1 issue
return $this-->feature->comments->first()->user_id === $this->user_id;
}
Improves
in controllor
$feature->load('comments.user', 'comments.feature.comments');
Improves more
$feature->load('comments.user');
$feature->comments->each->setRelation('feature', $feature);