PHP code example of jeidison / named-query
1. Go to this page and download the library: Download jeidison/named-query library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jeidison / named-query example snippets
return [
'path-sql' => database_path('named-query/queries'),
'type' => Jeidison\NamedQuery\Enums\TypeFile::XML,
'type-bind' => Jeidison\NamedQuery\Enums\TypeBind::TWO_POINTS,
];
CONST find_tab1 = "
SELECT * FROM TAB1 WHERE PAR1 = :PAR1
";
NamedQuery::executeNamedQuery('find_tab1', 'nfe/named-querys', [
'PAR1' => $numero,
]);
NamedQuery::executeNamedQuery('find_nfe_by_key', 'nfe/named-querys', [
'numero' => $numero,
'cnpj_emitente' => $cnpjEmitente,
'serie' => $serie,
'tpamb' => $tpAmb,
'mod' => $mod,
], NFe::class);
NamedQuery::executeNamedQuery('find_nfe_by_key', 'nfe/named-querys', [
'numero' => $numero,
'cnpj_emitente' => $cnpjEmitente,
'serie' => $serie,
'tpamb' => $tpAmb,
'mod' => $mod,
], NFe::class, true);
bash
$ php artisan vendor:publish --provider="Jeidison\NamedQuery\Providers\NamedQueryServiceProvider"
config/named-query.php
xml
<query name="find_tab1">
SELECT * FROM TAB1 WHERE PAR1 = ?1
</query>
config/named-query.php
config/named-query.php
Jeidison\NamedQuery\Enums\TypeFile::PHP