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; | |
use App\Models\Traits\Searchable; | |
use Illuminate\Database\Eloquent\Model; | |
class Customer extends Model | |
{ | |
use Searchable; |
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 | |
... | |
/** | |
* A basic test example. | |
* | |
* @return void | |
*/ | |
public function testSearchPageResult() |
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
<template> | |
<ValidationProvider :rules="rules" :name="$attrs.label"> | |
<b-form-group slot-scope="{ valid, errors }" :label="$attrs.label" :invalid-feedback="errors[0]"> | |
<b-input | |
:state="errors[0] ? false : (valid ? true : null)" | |
:name="$attrs.label.toLowerCase()" | |
:type="$attrs.type" | |
:placeholder="$attrs.placeholder" | |
v-model="innerValue" /> | |
</b-form-group> |
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
describe 'Race condition POST /api/v1/transaction/electricity', vcr: { cassette_name: 'race_condition_transaction_electricity' } do | |
it { expect(ActiveRecord::Base.connection.pool.size).to eq(5) } | |
context 'send requests simultaneously' do | |
let!(:user) { create(:user, limit_credit: 500_000, balance: 60_000) } | |
it 'should create one transaction' do | |
begin | |
concurrency_level = 4 | |
fail_occurred = false |
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
<script> | |
export default { | |
data: () => ({ | |
form: { | |
id: 1 | |
text: 'ABC' | |
} | |
}), | |
watch:{ | |
'form.id': function (newVal, oldVal){ |
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 UserController extends Controller | |
{ | |
public function index() | |
{ | |
$users = App\Models\Member::paginate(15, ['*'], "page[limit]"); | |
$users->appends(['name' => 'bertho']); |
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 | |
$response = ... | |
$this->app['session.store'] |
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
<!-- app/Http/Middleware/AdminAuthenticate.php --> | |
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Support\Facades\Auth; | |
class AdminAuthenticate |
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
# create encrypted password | |
# sudo sh -c "echo -n 'fpp:' >> /etc/nginx/.htpasswd" | |
# sudo sh -c "openssl passwd bar >> /etc/nginx/.htpasswd" | |
foo:BKlWoa/TUkUgc |
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 | |
.... | |
$products = Product::paginate(); | |
$products->getCollection()->each(function($product) { | |
// insert new data | |
$product->price = 1000; | |
}); |