I'm trying to group to bring totals into my query that is in mysql
SELECT COUNT(*) as total
,e.descricao
FROM pedido_cliente p
INNER JOIN estabelecimentos e on e.id = p.estabelecimento_id
GROUP BY p.estabelecimento_id,descricao...
I have the following tables listed below
Products
id
product
value
Validity
Queries
id
user_id
Product_Consults
id
query_id
product_id
Whenever a user performs a query, the history in the consultas...
I have 2 city and state tables I own the parana state and would like to know how to return all cities related to Parana state in a simple way without having to make a loop of repetition
Type
$estados = App/Estado::all();
$cidades = App/Cida...
I was developing an application with Laravel 5.5 with a Mysql database. Everything was working normally, however, now the database has been modified to SQL Server.
When I run the test, it returns the error "Invalid handle returned."
Searc...
I have the following scenario in a database:
Tables:
User
id,
name
email
Company
id
name
UserCompany
userid
business_id
start_date
data_termino
In this scenario, I need to bring the information...
Good afternoon. I have the following code that perfectly saves.
public function store(Request $request)
{
$this->validate($request, [
'servidor' => 'required|unique:servidors|max:255',
// 'dtprotocolo' => 'date|date...
I have two queries looking at the model. The first one is working normally:
$pedidos = Pedido::
orwhere(function($query){
$query->where('user_id', $_SESSION['idUsuario'])...
I have linked tables and when I need to access the information I recuse the query :
DB::table('paciente AS pac')
->leftJoin('pessoa AS p', 'p.id', '=', 'pac.id_pessoa')
->select('p.nome, pac.ficha')
->where('pa...
I'm starting with SQL of Laravel I looked a lot more I did not get a response of how to AND after where , follow sample code to implement AND .
SQL:
UPDATE contas
SET valor_titulo = 0,
WHERE id_contrato = 2...
I'm in a project that is in production, and by default when we use a foreign key in eloquent we follow the following rule "user_id" for example to store the user id.
Only in the database that I'm working with, they put this field as " id_u...