Showing posts with label Laravel. Show all posts
Showing posts with label Laravel. Show all posts

Tuesday, February 24, 2026

Info Ringkas Laravel 12

Laravel 12 adalah versi terbaru (rilis 24 Februari 2025), menghadirkan peningkatan performa, starter kit modern (Shadcn, Flux), dan integrasi autentikasi WorkOS yang lebih baik. Fokus pada stabilitas dan pengembangan aplikasi web modern, Laravel 12 mendukung PHP versi terbaru, serta mempermudah migrasi menggunakan Laravel Shift.

Fitur dan Pembaruan Utama Laravel 12 (Februari 2025):
  • Struktur Starter Kit Modern: Mendukung komponen UI modern seperti Shadcn dan Flux untuk integrasi lebih mudah dengan React, Vue, dan Livewire.
  • Peningkatan Autentikasi: Integrasi WorkOS AuthKit untuk SSO, passkeys, dan social login.
  • Pembaruan Dependensi & Performa: Optimalisasi untuk aplikasi modern dan scalable.
  • Laravel Shift: Mempermudah proses upgrade dan memastikan kompatibilitas paket pihak ketiga.
  • Ekosistem Terintegrasi: Dukungan penuh untuk tools seperti Laravel Breeze & Jetstream, Pulse, dan Reverb.
Sebelumnya, Laravel 11 (dirilis Maret 2024) membawa perubahan struktur folder yang lebih minimalis dan SQLite sebagai default database.

Saturday, March 8, 2025

Cloning Laravel dari Github

 

Installation Guide

Prerequisites

  • PHP >= 8.2
  • Composer
  • Node.js
  • npm

Installation Steps

  1. Clone the repository:

    git clone "isi urlnya"
  2. Navigate into the project directory:

    cd "nama foldernya"
  3. Install PHP dependencies:

    composer install
  4. Install JavaScript dependencies:

    npm install && npm run dev
  5. Copy the .env.example file and rename it to .env:

    copy .env.example .env
  6. Generate application key:

    php artisan key:generate
  7. Run database migrations:

    php artisan migrate
  8. Start the development server:

    php artisan serve
  9. Storage link
    
    php artisan storage:link
    
    
  10. Create User
    
    php artisan make:filament-user
    

Friday, October 27, 2023

Laravel CORS Middleware Setting

 What is CORS?

CORS stands for Cross-origin resource sharing. The concept is related to the same origin policy which all browsers implement. In a nutshell, this policy says that a web site may not perform web requests to a different web site, or to be precise, “origin” (scheme, hostname, port number). CORS is a mechanism that can relax such restrictions. While the browser enforces restriction, CORS must be implemented on the server side to let the browser know that it may relax the restrictions.

Install Laravel v10.28.0 (PHP v8.1.4) di Windows

1. Download Composer dan install (Pastikan terkoneksi internet)

2. buka CMD

 Microsoft Windows [Version 10.0.17134.1304]

(c) 2018 Microsoft Corporation. All rights reserved.


C:\Users\fuad hasan>composer

   ______

  / ____/___  ____ ___  ____  ____  ________  _____

 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/

/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /

\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/

                    /_/

Composer version 2.6.5 2023-10-06 10:11:52

3. buat project laravel masuk ke folder XAMPP/HTDOCS

C:\Users\fuad hasan>E:

E:>cd xampp\htdocs

E:\xampp\hdocs>composer create-project --prefer-dist laravel/laravel:^10.0 web-laravel


4. Jalankan Laravel

E:\xampp\hdocs\web-laravel>php artisan serve


Contoh Query pada Laravel

 <?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;

class ProvinceController extends Controller
{
    public function getAllProvince()
    {
        $provinces = DB::table('provinces')->get();

        return response()->json([
            'message' => 'success',
            'data' => $provinces
        ], 200);
    }

    public function filterProvince(Request $request)
    {
        $filter = strtoupper($request->filter);
        $provinces = DB::table('provinces')->where('name', 'like', "%$filter%")->get();

        return response()->json([
            'message' => 'success',
            'data' => $provinces
        ], 200);
    }
}

Routes pada Laravel v10.28.0 (PHP v8.1.4)

 <?php

use Illuminate\Http\Request;

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request)
{
    return $request->user();
});
Route::group(['middleware' => 'api'], function() {
    Route::get('all', 'App\Http\Controllers\ProvinceController@getAllProvince');
    Route::get('get', 'App\Http\Controllers\ProvinceController@filterProvince');
});