lpu Posts

INT221 – URL Generation – B.TECH (CSE) LPU Notes

URL GENERATION Current URL: To retrieve and display the current URL, you can do the following: Open an existing Blade view file or create a new one (e.g., resources/views/current-url.blade.php). In your Blade view file, add the following code to display the current URL: In current-url.blade.php <!DOCTYPE html> <html> <head> <title>Current URL Example</title> </head> <body> <p>Current … Read more

INT221 – Domain Routing – B.TECH (CSE) LPU Notes

Domain Routing Domain routing in Laravel allows you to route requests to different domains or subdomains to specific controllers and actions. This is useful for building applications with multiple subdomains or domain-specific routes. In web.php Route::domain(‘example.local’)->group(function () { Route::get(‘/’, [UserController::class, ‘showProfile’]); // Add more routes for example.com if needed }); // Route for a subdomain … Read more

INT221 – Controllers – B.TECH (CSE) LPU Notes

CONTROLLERS In Laravel, a controller is a crucial component used to handle HTTP requests and define the application’s response logic. Controllers serve as an intermediary between routes and the actual business logic of your application. Controllers Instead of defining all of your request handling logic as closures in your route files, you may wish to … Read more

INT221 – Controller Middleware – B.TECH (CSE) LPU Notes

CONTROLLER MIDDLEWARE Middleware in Laravel is a powerful mechanism for filtering HTTP requests entering your application. Middleware acts as a bridge or filter between the incoming request and your application’s routes or controllers. It can perform various tasks like authentication, authorization, logging, modifying the request or response, and more. Creating Middleware php artisan make:middleware MiddlewareName … Read more

INT221 – Blade Templates – B.TECH (CSE) LPU Notes

BLADE TEMPLATES Introduction Blade is the simple, yet powerful templating engine that is included with Laravel. Blade template files use the .blade.php file extension and are typically stored in the resources/views directory. Displaying Data You may display data that is passed to your Blade views by wrapping the variable in curly braces. For example, given … Read more

INT221 – Views – B.TECH (CSE) LPU Notes

VIEWS What is a route parameter in Laravel? a. A parameter passed in the request headers b. A parameter passed in the request body c. A placeholder value in the route URL d. A parameter passed as a query string What is a route parameter in Laravel? a. A parameter passed in the request headers … Read more

INT221 – Response – B.TECH (CSE) LPU Notes

RESPONSE What is the purpose of views in Laravel? A) To store database records. B) To separate controller/application logic from presentation logic. C) To define routes. D) To manage authentication. What is the purpose of views in Laravel? A) To store database records. B) To separate controller/application logic from presentation logic. C) To define routes. … Read more

INT221 – Redirections – B.TECH (CSE) LPU Notes

REDIRECTIONS A technique for making a web page available under more than one URL address Redirects The simplest method is to use the global redirect helper: Route::get(‘/dashboard’, function () { return redirect(‘home/dashboard’); }); Redirects(contd.) Redirecting To Named Routes – If your route has parameters, you may pass them as the second argument to the route … Read more