Skip to content

Instantly share code, notes, and snippets.

Route::get('/admin', [AdminController::class, 'index'])->middleware('auth');
return redirect()->route('dashboard');
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
Route::get('/user/{name?}', function ($name = 'Guest') {
return "Nama Pengguna: " . $name;
});
Route::get('/user/{id}', function ($id) {
return "User ID: " . $id;
});
use App\Http\Controllers\HomeController;
Route::get('/home', [HomeController::class, 'index']);
Route::get('/hello', function () {
return 'Halo, Laravel!';
});
<?php
$buah = "durian";
switch ($buah) {
case "apel":
echo "Buah yang dipilih adalah apel, rasanya manis dan segar!";
break;
case "pisang":
echo "Buah yang dipilih adalah pisang, cocok buat sarapan.";
break;
<?php
$buah = "apel";
switch ($buah) {
case "apel":
echo "Buah yang dipilih adalah apel, rasanya manis dan segar!";
break;
case "pisang":
echo "Buah yang dipilih adalah pisang, cocok buat sarapan.";
break;
<?php
$cuaca = "cerah";
if($cuaca == "mendung"){
echo "Diam dirumah";
}elseif($cuaca == "cerah"){
echo "pergi main bola";
}else{
echo "mancing aja";
}
?>