Transcript for:
Laravel Interview Questions Tutorial

hello everyone this is iamin and welcome to webtech knowledge in this tutorial we are going to talk about laraveen interview questions from beginner to Advanced so in digital we'll talk about around 20 plus laravel interview questions and you can expect at least four to five question will be asked on the interview from this tutorial so I'll start from the beginner question and then at the later part of this video I'll talk about the advance question with the answers so first of all the normal question is what is laravel so laravel is a free open source PHP web framework laravel follows the model view controller architecture pattern which is known as MBC now what are the benefits of laravel over other base speed Frameworks the benefit can be larabelle has inbuilt authentication system it also support multiple file system as well and the best thing about laravel is that it keep us eloquent orm orm means object relation mapping and then there is also some preloaded packages like laravel socialite laravel cashier passport and laravel Scout which help us to make our work mode easier in order to create a website Lara will also give us a lot of command like Artisan 2K database and other structures now explain migrations in laravel laurable migrations are like Version Control for the database allowing 18 to easily modify and share the application database schema now how do you generate migrations in order to generate migration you need to write this command PSP partition make migration and then you need to mention your table name now mention some of the so some of the packages provided by laravel are cashier passport Scout and socialite so what is cashier larval cashier is used for subscription based billing then why US Passport we use passport for API authentication using passport we can do APA authentication really easily and then let's talk about scout scout help us to make full text search in laravel now let's talk about socialite what does socialite do so using socialite we can log in using Facebook Twitter or using Google account now the another question can be how can we Implement soft delete in laurable so first of all what is sub dealer so so soft delete means basically that we do not want to show a certain data to the website but we will still keep the data in the database table so basically in order to implement soft delete you just need to go to the certain table model and then write use subdulets in the table model and after that in the table migration you need to mention table subdelet about that so what it will do is that it will create a time or date column in the database table and then once you just deleted it will just update the table date column so after that what will happen is that it will only show the data whose date is not updated in the web browser now for beginner in the interview they can also ask a question that how you can request validation in laravel so in order to validate a request all you need to do is that you need to say validated equal request validate and then let's say you have a title you can say require unique post and you can also Define how many character the user can write and in this validate function or method you can write a condition for email and password and for other text field as well now what is the purpose of the Artisan command line tool for laravel now addition command line tool can be used for making different kind of things like we can use PC Edition command to make controller so in order to make controller we need to say PSP Edition make controller and then the controller name then the same way we can also create the model migration Cedar Factory policy and other comment as well now can we use laravel for full stack development so full stack development means content and back end so Fontaine base what we see at the front of a website and back end means what is happening at the back end of our website and we can use laravel for creating both Advanced scalable full stack web development now how would you best describe service providers in laravel so service providers give us effective tools for performing dependency injection and maintaining classic dependencies additionally service providers give laravel instruction on how to bind different component to the laravel service container so here is the command for the service provider so in order to make a size folder you need to write this common phrasion make provider and you need to mention the service provider name now almost all the service provider extend this illuminate server support service provider class and most service providers have those following feature in their file which is register function and the boot function now what do you understand by eloquent object relationship mapper so basil what do you understand by orm so one of the key components of laravel framework is the eloquent or theme it can be described as more sophisticated active record pattern implemented in PHP so eloquent orm represent database table as classes with object instances bound to specific table draws so now explain what is middle or in laravel so we use middleware in laravel normally for verifying if the user is authenticated and if the user type is either admin or user so if the user type is admin then using middleware we can only let the admin have access to the admin page but the user won't be able to have access to the admin page because we use middleware middleware can be used for different cases for like verifying or for like checking the edges that if the edge is smaller than 18 then we will not the user have access to a certain page so in order to make middle R we need to write this command P Square addition make middle order and then you need to write your middle earn name it can the name can be anything and and then in order to register the middleware you need to write that middleware in the kernel.php I hope I am clear now explain what is the purpose of the code below so here you can see class verify csrf token extend base verifier and inside this it is written protected except pass your url here so basically here in the laravel we normally write csrf token for security reason but here in this except if we just write a specific route then it will not check the csrp token for that specific route so we can find this in the app HTTP middleware and in the middleware you will see verify CSI token dot PHP file over there and you can just choose a specific route that will not check the CSF token okay so what do you understand by trades and hotter states too basically so here you can see a code snap over here trade shareable so easing creates the web developer basically freely repurpose set of method across numbers independent classes with verifying class hierarchies so onset rate defined such as the code you just saw it can be used by other classes such as like this the code you are seeing over here here you can see class post use shareable so basically we are calling that certain trade so we are basically using the same function again and again so it will like decrease our code a lot so using an example explain what is throttling in laravel so here you can see a piece of code over here and here you can see a 60 comma on so basically we can like set a limit of request from a specific IP address using throttling so using this we can stop the DDOS attack Now list some Aggregates method provided by query builder in laravel so there is a lot of aggregate method in laravel that you can use like for example count Max mean average and sum we can use count in laravel in order to count total number of Tata then we can use max to find the most highest number we can use mean to find the most minimum number then using every G we can find the average number and using sum we can find the total number of a certain products or certain orders so what is routing we use routing to process of accepting a request and sending it to the relevant function in the controller so basically from The View if someone wants to go to a certain view then our route will send a request to the controller and the controller will written as the view in Laura will how can you declare a global variable so in order to declare Global variable you need to either write that in the dot EnV file or in the config.php what is seeding in laurable so so sitting is a insertion of data to the database table in order to test our project so what are the database supported by laravel framework so Lara will support MySQL post SQL SQL Lite and SQL Server so here you can see a piece of code over here so what you understand by this code here you can see the file is required it means the user must give the file and the file type can be only dock or PDF and the Mac size can be 2048 byte so what is the purpose of session in laurable so session is used to store data and keep track of users so what is csrf token csrf means cost site request for Journey scsf token is a unique value that is generated by the server side of the application and send it to the client so CSI token helps to protect web application from attacks which force user to perform an unwanted action commonly known as csrf attack so that's why in the form in order to protect our website in the form we use at that of csrf token so what is the difference between get and post method so gate method is used to get the data from the database table and post method is used in order to upload some data to the database table status codes so here you can see some status code that 41402 403 404 so for row on means unauthorized 402 means payment required 403 means forbidden and 404 but means not found and 500 meals internal service error 500 on means not implemented and 503 means service unavailable so those are the error message that we just commonly see in the laravel project so what are the common tools we use to send emails in laravel so in order to send email in laravel we can normally use mail crab mail gun postmark or Swift mailer those are the most common things that we normally use to send mails in laravel so how do you clear cache in laravel so in order to clear cache in laravel we need to write some commands that you are seeing over here which is PSP addition config clear this variation cache clear and there is also a common call composer term autoload then clear and P Square addition route clear so what do we mention the database name in laravel project so we mentioned the database name in The Dot EnV file how do you generate the application key in laravel so in order to generate the application key you need to write this in the command which is PSP Edition key clone generate so it will create a application key in your project so how can we extend the login expiration time in auth so if you want to extend the login expiration time then you need to go to config slash session.pc file then you need to update the value of the variable Lifeline over there so how do you roll back to the last migration in laravel so in order to roll back you need to write this command the aspiration make it roll back minus minus step equal to on so it will send you back to the last migration in laravel so how do you check the current route name so in order to check the current name all you have to do is that you need to write request route get name so those are the laravel question that I permanently asked in the interview I hope you learned something new and I also hope digital will help you with your larave interview so I would like to wish you good luck and make sure to subscribe this channel I hope to see you in the future tutorials