0% found this document useful (0 votes)
7 views4 pages

Breeze

The document provides a step-by-step guide on creating an anchored button in Laravel 11 that redirects to a specific route using the route() function. It also explains how to install and set up Laravel Breeze, a lightweight authentication package, including defining routes, creating controllers, running migrations, and customizing authentication pages. The conclusion emphasizes Laravel Breeze's simplicity and suitability for beginners, making it easy to implement authentication without extensive configuration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Breeze

The document provides a step-by-step guide on creating an anchored button in Laravel 11 that redirects to a specific route using the route() function. It also explains how to install and set up Laravel Breeze, a lightweight authentication package, including defining routes, creating controllers, running migrations, and customizing authentication pages. The conclusion emphasizes Laravel Breeze's simplicity and suitability for beginners, making it easy to implement authentication without extensive configuration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Laravel breeze And Anchor tag

Laravel 11 mein anchored button (jisko click karne par kisi specific route par le jaye) banana
bohot asaan hai. Tum route() function ka use kar ke easily anchor tag ya button create kar sakte
ho. Aao isko ek simple example se samajhte hain.

Step 1: Pehle Route Define Karo

Sabse pehle tumhe web.php file mein ek named route define karna hoga:

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HomeController;

Route::get('/home', [HomeController::class, 'index'])->name('home');

Yahan name('home') ka matlab hai ke is route ka naam home hoga, jo hum HTML ya Blade
file mein use karenge.

Step 2: Blade File Mein Anchored Button Banao

Ab kisi bhi Blade template (e.g., welcome.blade.php) mein anchored button add kar lo:

<a href="{{ route('home') }}" class="btn btn-primary">Go to Home</a>

Ya agar tum button tag use karna chahte ho, to yeh method use karo:

<button onclick="location.href='{{ route('home') }}'" class="btn btn-


success">
Home Page
</button>

Step 3: Controller Create Karo (Agar Zaroori Ho)

Agar HomeController abhi tak nahi hai, to terminal par yeh command run karo:

php artisan make:controller HomeController

Aur app/Http/Controllers/HomeController.php file mein yeh method add karo:


namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller


{
public function index()
{
return view('home'); // yahan 'home' ek blade file hogi
}
}

Final Result

Ab jab bhi tumhara button click hoga, user /home route par chala jayega, jahan
HomeController@index method execute hoga.

Laravel Breeze ek lightweight authentication package hai jo Laravel mein authentication system
ko bohot asaan banata hai. Yeh built-in authentication (login, register, logout, password reset,
etc.) provide karta hai aur beginner-friendly hai.

Aao step-by-step Laravel Breeze ko install aur samajhne ka tareeqa dekhein.

🔹 Step 1: Laravel Install Karo

Agar tumhare paas Laravel project nahi hai, to pehle ek naya Laravel project create karo:

composer create-project laravel/laravel myproject

Project folder mein jaane ke liye:

cd myproject

Agar pehle se Laravel install hai to is step ko skip kar sakte ho.

🔹 Step 2: Laravel Breeze Install Karo

Ab Laravel Breeze ko install karne ke liye yeh command run karo:


composer require laravel/breeze --dev

Phir Breeze ko setup karne ke liye yeh command chalao:

php artisan breeze:install

Yeh tumse poochega ke tum kis frontend stack ko use karna chahte ho. Agar tum sirf Blade
templates use karna chahte ho to blade choose kar lo.

🔹 Step 3: Migrations Run Karo

Breeze authentication system ke liye kuch database tables chahiye, jo migrations se create hongi.
Migration run karne ke liye:

php artisan migrate

Yeh command users, password resets, sessions aur authentication se related tables create kar
degi.

🔹 Step 4: NPM Install & Build Karo

Agar tum Tailwind CSS aur frontend assets ko use kar rahe ho to NPM dependencies install
karo:

npm install && npm run dev

Agar tumhe frontend ki zaroorat nahi hai, to is step ko skip kar sakte ho.

🔹 Step 5: Server Start Karo

Ab Laravel development server ko start karne ke liye:

php artisan serve

Browser mein jao aur http://127.0.0.1:8000 open karo.

🎯 Laravel Breeze Features

Laravel Breeze ke saath tum automatically ye authentication pages milte hain:


✅ Login Page (/login)
✅ Register Page (/register)
✅ Forgot Password Page (/forgot-password)
✅ Dashboard Page (/dashboard)
✅ Logout Functionality

Sab kuch ready-to-use hota hai! Tum sirf apni customization add kar sakte ho.

🔹 Extra: Breeze ko Customize Karna

Agar tum apni authentication system ko customize karna chahte ho, to ye files modify kar sakte
ho:

routes/web.php→ Yahan authentication routes defined hain


app/Http/Controllers/Auth/ → Yahan authentication controllers hain
resources/views/auth/ → Yahan login, register, aur password reset ki Blade files hain

Agar tum dashboard page ko change karna chahte ho, to:

resources/views/dashboard.blade.php

Is file ko modify kar sakte ho aur apne hisaab se design change kar sakte ho.

🎉 Conclusion

Laravel Breeze ek simple aur fast authentication package hai jo beginners ke liye best hai. Sirf
install karo, migrate karo, aur use karo – koi extra configuration ki zaroorat nahi!

Agar koi question ho to pooch sakte ho!

You might also like