Skip to content

Instantly share code, notes, and snippets.

View Encang-Cutbray's full-sized avatar

encang Encang-Cutbray

  • Indonesia
View GitHub Profile
@Encang-Cutbray
Encang-Cutbray / gist:f0ae2f0c53917ffd0668687d71384c16
Last active December 7, 2021 10:58
Laravel 5, Check perform if updateOrCreate
$user = UserModel::updateOrCreate(['name' => 'Cinta] ,['email' => 'cinta@email.com']);
if (!$user->wasRecentlyCreated && $user->wasChanged()) {
// This run as update
}
if ($user->wasRecentlyCreated) {
// This run as create
}
@Encang-Cutbray
Encang-Cutbray / paginator.txt
Last active November 6, 2022 09:09
Laravel Pagination with transform
$users = tap(User::query()
->paginate(100),function($paginatedInstance){
return $paginatedInstance->getCollection()->transform(function ($value) {
$value->test = 'test';
return $value;
});
});
require __DIR__ . '/vendor/autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
try {
$connector = null;
$connector = new WindowsPrintConnector("xp-58");
$printer = new Printer($connector);
i am handsome
she is beautiful
he is a programmer
we are a secret admire
they are covididiot
am i handsome ?
is she beautiful ?
is he a programmer ?
are we a secret admire ?
@Encang-Cutbray
Encang-Cutbray / Be - The Present Simple Tense
Last active May 1, 2020 17:18
Learn grammatical present simple tense
`Be + Noun`
@Encang-Cutbray
Encang-Cutbray / Tense phrase.md
Last active May 1, 2020 17:10
Tense phrase table

Tense Phrase Table

Time \ Event Simple
None
Continuous
Be + V_ing
Perfect
Have + V3
Perfect Continuous
Have + been + V_ing
Present
V1/Vs/Ves.
Mantap Mantap Mantap Mantap
Past
V1/Vs/Ves.
Mantap Mantap Mantap Mantap
Future
V1/Vs/Ves.
Mantap Mantap Mantap Mantap
Past Future V1/Vs/Ves Mantap Mantap Mantap Mantap