Skip to content

Instantly share code, notes, and snippets.

View adeguntoro's full-sized avatar

Ade Guntoro adeguntoro

View GitHub Profile
@adeguntoro
adeguntoro / RoleCheck.php
Created September 13, 2022 13:31
middleware to check user login
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Auth;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
@adeguntoro
adeguntoro / prime.php
Created November 13, 2019 15:27
Check all prime number
<?php
$count = 0;
$num = 2;
while ( $count < 15 ){
$div_count = 0 ;
for ( $i=1; $i<=$num; $i++){
if (($num%$i)==0) {
$div_count++;
}
}
@adeguntoro
adeguntoro / php looping
Last active November 15, 2019 14:27
php Looping
<?php
$f = new NumberFormatter("id", NumberFormatter::SPELLOUT);
echo "#####################<br>";
echo $f->format(5)."<br>";
$a = $f->format(169);
$pisah = explode(" ", $a);
echo "#####################<br>";
echo "foreach array<br>";
foreach($pisah as $key) {
echo $key.'<br/>';
@adeguntoro
adeguntoro / contoller
Created November 13, 2019 06:52
laravel 2 form
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class Checkbox extends Controller {
public function index()
{
//
return view('checkbox.index');
}
@adeguntoro
adeguntoro / controller
Created November 9, 2019 09:02
modal form
<?php
namespace App\Http\Controllers;
use App\Form;
use Illuminate\Http\Request;
class FormController extends Controller
{
@adeguntoro
adeguntoro / arrival_time.php
Created October 31, 2019 21:34
Menghitung Waktu kedatangan
<?php
$distance = 2000; //KM
$average_speed = 19; //KMh
$travel_time = $distance / $average_speed;
$departure_time = "2019-05-30 12:30:56";
$split = explode(".", $travel_time);
$hours = $split[0];
@adeguntoro
adeguntoro / controller
Created October 24, 2019 08:35
dynamic vs static form
dynamic form controller :
public function store(Request $request) {
dd($request->post());
}
#####################
static form controller :
public function store(Request $request) {
dd($request->post());
}
@adeguntoro
adeguntoro / Database and Model
Created October 21, 2019 16:02
dynamic form
//database
Schema::create('reseps', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('nama_masakan');
$table->string('foto_masakan');
$table->string('nama_kategori');
$table->json('bahan');
$table->longText('langkah');
$table->timestamps();
});
@adeguntoro
adeguntoro / updating_ruby_with_rvm_on_a_mac.md
Created October 6, 2018 19:36 — forked from wrburgess/updating_ruby_with_rvm_on_a_mac.md
Updating Ruby with rvm or rbenv on a Mac

RBENV

  • rbenv install -l
  • rbenv install 2.4.3
  • rbenv local 2.4.3
  • gem bundler install
  • bundle install

RVM