Skip to content

Instantly share code, notes, and snippets.

View bolechen's full-sized avatar
💭
I may be slow to respond.

Bole Chen bolechen

💭
I may be slow to respond.
View GitHub Profile
@bolechen
bolechen / HasPivotTrait.php
Created July 19, 2019 03:00
Check if belongsToMany relation exists
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Model;
trait HasPivotTrait
{
/**
* 检查多对多关系是否存在.
*
@bolechen
bolechen / HasUuid.php
Last active October 12, 2020 10:58
Laravel Model Use Uuid
<?php
namespace App\Traits;
use Illuminate\Support\Str;
trait HasUuid
{
/**
* Get the route key for the model.
<?php
function is_weixin() {
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) {
return true;
}
return false;
}