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 main() { | |
// IMPORT loyalty accounts from merchant SQ1 | |
importLoyaltyAccounts('SQ1'); | |
// IMPORT loyalty accounts from merchant SQ2 | |
importLoyaltyAccounts('SQ2'); | |
// throttler that limits the # of requests up to 20rps to LoyaltyAPI and up to 100rps for FS application | |
// throttler will pause requests either if # or requests to LoyaltyAPI exis |
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\Terranet\Administrator\Modules; | |
use function admin\output\image; | |
use Illuminate\Database\Eloquent\Model; | |
use Terranet\Administrator\Form\Type\Image; | |
use Terranet\Administrator\Modules\Users as CoreUsersModule; | |
/** |
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
use HasTranslations, EloquentTrait { | |
HasTranslations::getAttribute as getTranslatedAttribute; | |
HasTranslations::setAttribute as setTranslatedAttribute; | |
EloquentTrait::getAttribute as getStaplerableAttribute; | |
EloquentTrait::setAttribute as setStaplerableAttribute; | |
} | |
public function getAttribute($key) | |
{ |
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 SomeClass { | |
use HasTranslations, EloquentTrait { | |
HasTranslations::getAttribute as getTranslatedAttribute; | |
HasTranslations::setAttribute as setTranslatedAttribute; | |
EloquentTrait::getAttribute as getStaplerableAttribute; | |
EloquentTrait::setAttribute as setStaplerableAttribute; | |
} |
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
-- --------------------------------------------------------------------------- | |
-- Levenshtein distance | |
-- from the Artful Common Queries page | |
-- http://www.artfulsoftware.com/infotree/qrytip.php?id=552 | |
-- --------------------------------------------------------------------------- | |
-- The Levenshtein distance between two strings is the minimum number of | |
-- operations needed to transform one string into the other, where an operation | |
-- may be insertion, deletion or substitution of one character. |
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 | |
public function delete(Module $module) | |
{ | |
$this->authorize('delete', $eloquent = app('scaffold.model')); | |
app('scaffold.actions')->exec('delete', [$eloquent]); | |
$message = trans('administrator::messages.remove_success'); |
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
From f0f3fe15becb32c85613728c67694b9a0bc91a82 Mon Sep 17 00:00:00 2001 | |
From: Endi <[email protected]> | |
Date: Mon, 6 Feb 2017 15:52:01 +0200 | |
Subject: [PATCH] Set default active status | |
--- | |
src/Middleware/Resources.php | 9 ++++++++- | |
1 file changed, 8 insertions(+), 1 deletion(-) | |
diff --git a/src/Middleware/Resources.php b/src/Middleware/Resources.php |
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 | |
... | |
public function form() | |
{ | |
return $this | |
->scaffoldForm() | |
->update('fieldname', function ($e) { | |
return $e->setInput((new \Terranet\Administrator\Form\Type\Key('fieldname'))); | |
}); |
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
Hello. | |
Nothing can say more than an example :) | |
Let's say you have a model Post and a Post::user() belongsTo relationship as like as Post::tags() serves as many to many relationship to another tags table. | |
<?php | |
namespace App; |
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 | |
function getId($chunks = 4, $chunkLen = 4) { | |
$max = pow(36, $chunkLen) - 1; | |
$id = ''; | |
for ($i = 0; $i < $chunks; ++$i) { | |
$r = (mt_rand(0, $max) * (microtime(true) * 10000)) / mt_rand(0, $max); | |
$id .= str_pad(base_convert($r, 10, 36), $chunkLen, "0", STR_PAD_LEFT); | |
} |
NewerOlder