0% found this document useful (0 votes)
43 views3 pages

Perintah Laravel

The document provides a step-by-step guide on how to run a Laravel web application on a browser using the same Wi-Fi network. It includes instructions for configuring the application URL, setting up Vite, running the server, and various artisan commands for database management and resource creation. Additionally, it covers installation of necessary packages and configurations for Laravel Filament and Blade formatting.

Uploaded by

budi.h2nd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views3 pages

Perintah Laravel

The document provides a step-by-step guide on how to run a Laravel web application on a browser using the same Wi-Fi network. It includes instructions for configuring the application URL, setting up Vite, running the server, and various artisan commands for database management and resource creation. Additionally, it covers installation of necessary packages and configurations for Laravel Filament and Blade formatting.

Uploaded by

budi.h2nd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Cara run laravel web di browser dengan 1 jaringan wifi yang sama

- ipconfig di cmd untuk lihat ip komputernya


- ubah ip yang di vite dari # APP_URL=http://localhost menjadi contoh ip komputer
kita APP_URL=http://192.168.2.130:8000
- lalu tambahkan ini didalam vite.config.json
di dalam export default defineConfig({ ...... }) tambahkan :
server: {
host: '0.0.0.0',
port: 5173,
strictPort: true,
hmr: {
host: '192.168.2.130', // IP PC Anda
}
},

test api di postman dengan get http://192.168.1.7:8000/api/hello

- php artisan serve --host=192.168.2.130 --port=8000 //jika ingin run di browser


hp
- npm run dev -- --host 192.168.2.130 //jika ingin run di browser hp
⚠ Pastikan
✅ Firewall di PC Anda tidak memblokir port 8000
✅ HP dan PC 1 jaringan Wi-Fi / LAN

////Cron Job local, di terminal powershell


while ($true) {
& "D:\Database\laragon\bin\php\php-8.4.2-nts-Win32-vs17-x64\php.exe" artisan
gps:save-history
Start-Sleep -Seconds 5
}

1. npm run dev


php artisan serve
2. php artisan migrate
3. php artisan migrate:fresh
php artisan migrate:fresh --seed
php artisan make:controller name -r

php artisan make:resource NamaResource //contoh LiveGpsResource, untuk untuk


mengatur json controlernya agar lebih rapih datanya

php artisan storage:link


php artisan config:publish cors

laravel filament :

composer require filament/filament:"^3.3" -W


php artisan filament:install --panels
php artisan make:filament-user

php artisan make:filament-resource namamodel --generate

php artisan make:policy OfferPolicy --model=Offer


php artisan make:policy PurchaseOrderPolicy --model=PurchaseOrder
php artisan make:policy CategoryPolicy --model=Category
hapus filamen:
composer remove filament/filament

4. php artisan tinker


App\Models\Post::factory(100)->create()
App\Models\Post::factory(100)->recycle(User::factory(5)->create())->create()
App\Models\Post::factory(100)->recycle([Category::factory(3)->create(),
User::factory(5)->create()])->create()

5. php artisan make:model name -m [ini membuat model dan migration saja]
php artisan make:model name -mc [ini membuat model, controller dan migration
saja]
php artisan make:model name -mf [ini sekalian bikin migrasi dan faketory]
php artisan make:component nameComponent
php artisan make:component namecomponent --view
6. composer dumpautoload
7. php artisan optimize:clear
8. php artisan make:seeder nameSeeder
php artisan db:seed --class=RoleSeeder
9. php artisan db:seed

$budiharyono = User::create([
'name' => 'Budi Haryoono',
'username' => 'budiharyono',
'email' => 'budi.h1stgmail.com',
'email_verified_at' => now (),
'password' => Hash::make('password'),
'remember_token' => Str::random(10)
]);

Post::factory(100)->recycle([
Category::factory(3)->create(),
$budiharyono,
User::factory(5)->create()
])->create();
10. composer require barryvdh/laravel-debugbar --dev
composer remove barryvdh/laravel-debugbar
11. npm install -D flowbite
12. npx tailwindcss init -p
13. npm i -D flowbite-typography
npm i -D flowbite-typography
14. php artisan vendor:publish
15. composer self-update = biar cmd di laragon gk kuning kuning
16. npm list vite
kalo empty, install ini
npm install vite --save-dev
17. rm composer.lock (menghapus composer.lock)
18. rm -rf vendor (menghapus folder vendor)
19. composer clear-cache
20. composer install
21. php artisan config:publish cors //untuk allow origin jika laravel menjadi web
server
php artisan config:clear
php artisan config:cache
Cara instal formater blade
1. npm install -g blade-formatter
tambahkan ini ke package.json
"scripts": {
"build": "vite build",
"dev": "vite",
"format-blade":"blade-formatter --write resources/**/*.blade.php"
},
2. npm run format-blade

-- ht akses untuk h panel agar bisa membaca db


.htaccess

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_URI} !^/public/

RewriteCond %{REQUEST_FILENAME} !-d


RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ /public/$1


#RewriteRule ^ index.php [L]
RewriteRule ^(/)?$ public/index.php [L]
</IfModule>

- setiap kali menambahkan route/api harus php artisan route:cache

You might also like