rbenv install -l
rbenv install 2.4.3
rbenv local 2.4.3
gem bundler install
bundle install
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\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
use Auth; | |
use Spatie\Permission\Models\Role; | |
use Spatie\Permission\Models\Permission; |
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 | |
$count = 0; | |
$num = 2; | |
while ( $count < 15 ){ | |
$div_count = 0 ; | |
for ( $i=1; $i<=$num; $i++){ | |
if (($num%$i)==0) { | |
$div_count++; | |
} | |
} |
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 | |
$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/>'; |
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\Controllers; | |
use Illuminate\Http\Request; | |
class Checkbox extends Controller { | |
public function index() | |
{ | |
// | |
return view('checkbox.index'); | |
} |
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\Controllers; | |
use App\Form; | |
use Illuminate\Http\Request; | |
class FormController extends Controller | |
{ |
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 | |
$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]; |
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
dynamic form controller : | |
public function store(Request $request) { | |
dd($request->post()); | |
} | |
##################### | |
static form controller : | |
public function store(Request $request) { | |
dd($request->post()); | |
} |
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
//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(); | |
}); |