<?php
namespace App;
class Item
{
protected float $weight;
protected float $width;
protected float $height;
This file contains 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 | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Support\Facades\Vite; | |
use Illuminate\Support\Str; | |
/** | |
* Simple Content Security Policy middleware. |
This file contains 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
<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> |
This file contains 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
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}` }, | |
}) |
This file contains 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 | |
namespace App\Casts; | |
use Illuminate\Contracts\Database\Eloquent\CastsAttributes; | |
class Money implements CastsAttributes | |
{ | |
/** | |
* @var string |
This file contains 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 | |
namespace App\Models\Concerns; | |
trait SearchBuilder | |
{ | |
public function scopeSearchBuilder($query) | |
{ | |
if (request()->filled('searchBuilder') && request()->query('searchBuilder') !== 'false') { | |
$query->where(function ($query) { |
This file contains 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
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) |
This file contains 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
(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')); |
This file contains 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 | |
/** | |
* Class InviteCode | |
* 邀请码生成类 | |
* | |
* ``` | |
* $inviteCode = new InviteCode('123456789'); | |
* var_dump($inviteCode->enCode(1)); // string(8) "00000002" | |
* var_dump($inviteCode->deCode("00000002")); // int(1) |
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).
NewerOlder