I have the following table in the database
public function up()
{
Schema::create('cidades', function (Blueprint $table) {
$table->increments('id');
$table->integer('uf');
$table->string('nome_uf');...
I'm starting to work with Laravel and wanted to know if you can help me.
I need to update a single value in the database, using 'name' in the where clause instead of id.
This is for a situation of a real system that I need to migrate to Larav...
Let's say you have the following fields in the users table:
ID , NOME , USUARIO , LOGIN and SENHA
For me to insert a record into the table I do the following
$usuario = new Usuario();
$usuario->nome...
I have the following problem, I logged into a project where the database already existed and is in production, so all the foreign keys of this database are under the nomenclature fk_ and Eloquent of Laravel , related the% of%...
I have controller that plays for my view the total number of courses registered in the portal. My doubts are due to the operation of the count() method.
For example, output of both statements below are equivalent:...
How to mount eloquent the following query?
SELECT * FROM nos.destinos d join nos.servidors s on (d.idservidor = s.idservidor)
where s.servidor like '%nome%'
My templates
class Servidor extends Model
{
protected $primaryKey = 'idserv...
How do I generate the query below with Eloquent , since Group By of error in Eloquent .
SELECT
otimibus_gps.positions.id,
otimibus_gps.positions.deviceid,
otimibus_gps.positions.devicetime,
otimibus_gps.positions.lat...
I have a page of orders, we will take as base a mercantile, where the person buys 3 soft drinks each with the value of $ 6.00 and 2 cookies in the amount of $ 2.00 each.
I first need to multiply these values (3 * 6) and (2 * 2) and then add th...
I have the following select in my controller:
$turmaAlunos = DB::select('
SELECT alunos.ST_ALUNO_ALU, alunos.ID_ALUNO_ALU
FROM alunos WHERE alunos.ID_ALUNO_ALU NOT IN (
SELECT turma_alunos.ID_ALUNO_ALU
FROM turma_alunos...