Skip to content

Instantly share code, notes, and snippets.

View juniorb2ss's full-sized avatar
🎯
Focusing

Carlos E. Oliveira juniorb2ss

🎯
Focusing
View GitHub Profile
$userfb = Socialite::driver('facebook')->user();
$user = User::where('idsocial' ,$userfb->getId())->first();
if(!$user){
$user = new User();
$user->idsocial = $userfb->getId();
$user->social = "Facebook";
$user->avatar = $userfb->getAvatar();
$user->name = $userfb->getName();
$user->email = $userfb->getEmail();
$user->password = bcrypt('temp');
class pagseguro extends MX_Controller
{
public function __construct() {
parent::__construct ();
$this->load->library('PagSeguroLibrary');
}
/**
* retornoPagamentoPagseguro
@juniorb2ss
juniorb2ss / gist:2f12534897ee9684fa8e
Created April 21, 2015 18:49
Find URL in String
<?php
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
$text = "Visite: http://google.com e pesquise antes de perguntar.";
if(preg_match($reg_exUrl, $text, $url)) {
echo preg_replace($reg_exUrl, "<a href=$url[0]>$url[0]</a>", $text);
} else {
echo $text;
$user = $users->where('id', Sentry::getUser()->id)
->whereHas('clientes', function($q){
$q->where('cnpj', \Input::get('destinatario'));
$q->whereHas('configuracoes', function($q){
# Apenas clientes que tenham certificado configurado
$q->whereNotNull('ambiente');
$q->limit(1);
select * from `users` where `id` = '10' and (select count(*) from `clientes` inner join `users_clientes` on `clientes`.`id` = `users_clientes`.`clientes_id` where `users_clientes`.`users_id` = `users`.`id` and `cnpj` = '20434235000106' and (select count(*) from `configuracoes_nfe` where `configuracoes_nfe`.`clientes_id` = `clientes`.`id` and `ambiente` is not null limit 1) >= 1 limit 1) >= 1 limit 1
foreach ($user as $key) {
echo $key->id . PHP_EOL;
foreach ($key->clientes as $key) {
echo $key->nome;
}
}
$user = $users->where('id', Sentry::getUser()->id)
->whereHas('clientes', function($q){
$q->where('cnpj', \Input::get('destinatario'));
$q->whereHas('configuracoes', function($q){
# Apenas clientes que tenham certificado configurado
$q->whereNotNull('ambiente');
$q->limit(1);
#a:hover + #b #c {
background: #ccc
}
<div id="a">Div A</div>
<div id="b">hello<div id="c">world</div></div>
protected static function boot() {
parent::boot();
static::deleting(function($produtos) {
if ($produtos->imagens()->count() > 0)
{
$produtos->imagens->delete();
# File::delete(public_path().'id.jpg');
}
});
}
class Wiki_Creature extends \Illuminate\Database\Eloquent\Model {
protected $table = 'wiki_creature';
protected $with = ['getloot'];
public function getLoot()
{
return $this->hasMany('DevAAC\Models\Wiki_Creature_Loot', 'name');
}