This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Transaction::open(self::$database); # ABRE A CONEXÃO | |
$id = 1; | |
$cliente = Cliente::find($id); | |
if ($cliente) { echo "Cliente: {$cliente->nome}"; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$objeto = new stdClass(); | |
$objeto->nome = 'FABRICIO'; | |
$objeto->celular = '(83) 98655-6461'; | |
$objeto->idade = '34'; | |
TForm::sendData(self::$formName, $objeto); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cliente = new Cliente(); | |
$cliente->nome = 'FABRICIO'; | |
$cliente->celular = '(83) 98655-6461'; | |
$cliente->email = '[email protected]'; | |
$cliente->store(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$id = 1; | |
$cliente = Cliente::find($id); | |
if($cliente) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$id = 34; | |
$produto = Produto::find($id); | |
if($produto) | |
{ | |
$produto->delete(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$id = 1; | |
$objeto = Produto::find($id); // BUSCA O REGISTRO | |
if($objeto) // SE EXITIR | |
{ | |
$nome = $objeto->nome; // ATRIBUI O VALOR DO CAMPO NA VARIÁVEL | |
$celular = $objeto->celular; | |
$email = $objeto->email; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cep->setExitAction(new TAction([$this,'onCep'])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# OCULTAR | |
TScript::create("$(\"[name='campo']\").closest('.fb-inline-field-container').hide()"); | |
# MOSTRAR | |
TScript::create("$(\"[name='campo']\").closest('.fb-inline-field-container').show()"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# BUSCA O REGISTRO PELO ID USANDO O MÉTODO find | |
$id = 1; | |
$cliente = Cliente::find($id); | |
if ($cliente) | |
{ | |
echo "Cliente: {$cliente->nome}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# COM FILTRO | |
$qtd_produtos = Produto::where('grupo', '=', 'BEBIDAS')->count(); | |
# SEM FILTRO, TODOS OS REGISTROS | |
$qtd_produtos = Produto::count(); |
OlderNewer