-1
$id= $this->id;
$consulta = DB::select('select *from locacao where id = ?',[$id]);
$consulta->count();
I tried it :(but it didn’t work out the $query->Count(); I only find things related to the eloquent, but I didn’t like it, I’m using this runningquery method of Laravel, how can I know the Qt of lines returned in the query? :(
CODIGO TODO:
<?php
namespace App;
use Illuminate\Support\Facades\DB;
class LocacaoBanco {
public $datalocacao;
public $datadevolucao;
public $valorlocacao;
public $estadodevolucao;
public $id;
public function __construct() {
$this->datalocacao = "2019-01-01 00:00:00";
$this->datadevolucao = "2019-01-01 00:00:00";
$this->valorlocacao = 5.20;
$this->estadodevolucao = "nao";
$this->id = 0;
}
public function setRegLocacao() {
$datalocacao = $this->datalocacao;
$datadevolucao = $this->datadevolucao;
$valorlocacao = $this->valorlocacao;
$estadodevolucao = $this->estadodevolucao;
$id = $this->id;
DB::insert('insert into locacao (datalocacao,datadevolucao,valorlocacao,estadodevolucao) values (?,?,?,?,?)',[$datalocacao,$datadevolucao,$valorlocacao,$estadodevolucao,$id]);
echo "Insercao da tabela locacao executada";
}
public function setAtualizaLocacao() {
$datalocacao = $this->datalocacao;
$datadevolucao = $this->datadevolucao;
$valorlocacao = $this->valorlocacao;
$estadodevolucao = $this->estadodevolucao;
$id = $this->id;
DB::update("update locacao SET datalocacao = ?,datadevolucao = ?,valorlocacao=?,estadodevolucao=?,id=? ",[$datalocacao,$datadevolucao,$valorlocacao,$estadodevolucao,$id]);
echo "locacao atualizada";
}
public function getConsultaLocacao() {
$id= $this->id;
$consulta = DB::select('select *from locacao where id = ?',[$id]);
$consulta->count();
}
}
?>
Guys?? Help me please
– Lorena Stripper
Lorena you’re using the wrong Laravel, it’s Complicated help you
– novic