Skip to content

Instantly share code, notes, and snippets.

Avatar

Robbyn Rahmandaru robzlabz

View GitHub Profile
@robzlabz
robzlabz / index.js
Created Jul 8, 2020
Menambahkan Field
View index.js
const User = mongoose.model('User', new mongoose.Schema({
username: String,
password: String,
about: String,
joinAt: Date,
points: Number
}))
@robzlabz
robzlabz / index.js
Created Jul 8, 2020
Admin Bro Mongoose Example
View index.js
const AdminBro = require('admin-bro')
const AdminBroExpress = require('admin-bro-expressjs')
const AdminBroMongoose = require('admin-bro-mongoose')
const express = require('express')
const app = express()
AdminBro.registerAdapter(AdminBroMongoose)
const mongoose = require('mongoose')
View stringL7.php
<?php
$kata = "aku adalah anak gembala ";
$hasil = Str::of($kata)->upper()->trim()->replace('aku', 'kamu');
View string.php
<?php
// kasus 1
$kata = "aku adalah anak gembala ";
$hasil = str_replace('aku', 'kamu', trim(strtoupper($kata)));
// kasus 2
$hasil = strtoupper($kata);
$hasil = trim($hasil);
$hasil = str_replace('aku', 'kamu, $hasil);
View UserController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function getRequest() {
// kode kamu disini
View controller.plain.stub
<?php
namespace {{ namespace }};
use {{ rootNamespace }}Http\Controllers\Controller;
use Illuminate\Http\Request;
class {{ class }} extends Controller
{
public function getRequest() {
View MemberController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class MemberController extends Controller
{
public function index()
{
View MemberController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class MemberController extends Controller
{
//
}
View HttpClientCool.php
<?php
// set timeout
Http::timeout($second)->get('...');
// retry
Http::retry($times, $wait)->post('...');
// throw
Http::post('...')->throw()->json();
View MakeRequest.php
<?php
use Illuminate\Support\Facades\Http;
// kirim request
Http::get('...');
Http::post('...');
Http::put('...');
Http::delete('...');
You can’t perform that action at this time.