I hereby claim:
- I am vanthao03596 on github.
- I am vanthao0359696 (https://keybase.io/vanthao0359696) on keybase.
- I have a public key ASC04EsoXcw-sRf0dskWggTqMySbG2Cvcd7XqDT5Om7oSgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Translations: Korean (by Yongwoo Lee)
Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.
I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).
<?php
namespace App;
class Item
{
protected float $weight;
protected float $width;
protected float $height;
<?php | |
/** | |
* Class InviteCode | |
* 邀请码生成类 | |
* | |
* ``` | |
* $inviteCode = new InviteCode('123456789'); | |
* var_dump($inviteCode->enCode(1)); // string(8) "00000002" | |
* var_dump($inviteCode->deCode("00000002")); // int(1) |
(function (factory) { | |
if (typeof define === 'function' && define.amd) { | |
// AMD | |
define(['jquery', 'datatables.net', 'datatables.net-editor'], factory); | |
} | |
else if (typeof exports === 'object') { | |
// Node / CommonJS | |
module.exports = function ($, dt) { | |
if (!$) { $ = require('jquery'); } | |
factory($, dt || $.fn.dataTable || require('datatables.net')); |
const { userAgent } = window.navigator | |
export const isIos = /iPhone|iPad/.test(userAgent) | |
export const isAndroid = /Android/.test(userAgent) | |
export const isMobile = isIos || isAndroid | |
export const isMac = /Mac/.test(userAgent) | |
export const isDesktopSafari = !isMobile && /Safari/.test(userAgent) | |
export const isIosApp = /HEY iOS/.test(userAgent) | |
export const isAndroidApp = /Haystack Android/.test(userAgent) |
<?php | |
namespace App\Models\Concerns; | |
trait SearchBuilder | |
{ | |
public function scopeSearchBuilder($query) | |
{ | |
if (request()->filled('searchBuilder') && request()->query('searchBuilder') !== 'false') { | |
$query->where(function ($query) { |
<?php | |
namespace App\Casts; | |
use Illuminate\Contracts\Database\Eloquent\CastsAttributes; | |
class Money implements CastsAttributes | |
{ | |
/** | |
* @var string |
const qs = `itemid=${id}&shopid=${shopId}`; | |
const qsHash = crypto.createHash('md5').update(qs).digest('hex'); | |
const none = crypto.createHash('md5').update(`55b03${qsHash}55b03`).digest('hex'); | |
const data = await axios.get(`https://shopee.vn/api/v2/item/get?${qs}`, { | |
headers: { 'if-none-match-': `55b03-${none}` }, | |
}) |
<div class="form-group"> | |
<label>Banner lớn:</label> | |
<div class="row"> | |
<div class="col-md-4"> | |
<div class="card"> | |
<div class="card-img-actions m-1"> | |
<img class="card-img img-fluid" src="/global_assets/images/no-image.jpg" alt="" id="preview_banner"> | |
<div class="card-img-actions-overlay card-img"> | |
<a href="/global_assets/images/no-image.jpg" class="btn btn-outline-white border-2 btn-icon rounded-pill" data-popup="lightbox" data-gallery="gallery1"> | |
<i class="icon-plus3"></i> |