Basic Artisan Commands | Laravel For Beginners | Learn Laravel

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys my name is dory and i hope to have a great day because today i'm going to introduce you a little bit more to artisan i know that during this course we talked a lot about artisan before i show you a couple other important commands that we could use i want to look in the root folder of our application because you might have noticed that there's a file in here called artisan so let's open it and this is the file that you're calling with the php artisan command what you're basically doing is passing the file into php so it could be parsed everything after the php artisan command is just passed into artisan as an argument now for the people that have worked with php symphony framework artisan is a layer on top of the symphony console component if you are familiar with writing symphony console commands you should feel comfortable with php artisan there's also a possibility to get a list of all available artisan commands to do that let's hop to our cli and let me zoom in all right and here we can run php artisan list from the project root and as you can see right here we're getting an entire list of artisan commands that we could use honestly there's not enough space and time here to cover all of the commands as you could see there are so many but we'll cover some of them what i have done is separating some basic commands that might be useful with some grouped commands i want to start off with the basic commands so in our cli we could write down php artisan clear dash compiled now what this command will do is removing laravel's compiled class file let's run it and if you do not know what that is well it's like an internal laravel cache run now the second one is the down and up method so php artisan down and this is used to put your application in maintenance mode in order for you to fix an error run migrations or whatever else and if you want to restore an application from maintenance mode use the php artisan up method as you all might know we have a emv file where we store the environment variables that we have in our application with the php artisan emv command we can see the current application environment and right now it's local because we're running it locally now the command that i use a lot and will help you in the future as well is php artisan help as the name suggests it will provide a global help and a help for a command and right now you can see a couple options so let's say php artisan dash dash version and we get a version number php artisan emv and we're getting everything that we could use from the emv now the next command is the php artisan optimize command and this will clear and refresh the configuration and route files these are the basic artisan commands that you need to know next to the controller migration and model commands because you do need these when you work on a real-life project beside the basic commands there's also a list of group commands and we won't cover them all but i'll cover the most important ones if you have worked with php before you must have run into clearing your cache once in your life in laravel you could do that using the php artisan cache colon clear command and right now you can see that our application cache has been cleared so whenever your css isn't loading you know what to do right now in the next video we're going to create a complete login system but when we do that there will be a column in our database with a password reset token let me show that to you let's go to my sql select everything from users let's say desk users and right here you can see i remember token but you don't always want your remember token to be saved in the database what we could do is to clear these with an artisan command instead of using the delete from method in mysql so what you need to do is to run php artisan aut colon clear dash resets and this will remove all expired reset tokens that you have in your database as you can see it runs right now because laravel will automatically create a users table in our database even if you don't did it yourself but we have no data so nothing has been deleted we can generate a random application encryption code which will be stored in our emv file with the php artisan key column generate command and right now you can see that the application key has been set successfully so let's go to the code let's open our emv file and you can see our app underscore key which is an encrypted token whenever you have an application that needs to use sessions you can create it manually in the code but you could also do that with artisan so in the cli let's write down php artisan session colon table and as you can see this will create a migration for us so let's go to our database directory migrations and it's the last one obviously and right here you can see a new schema with the name sessions that will store our users information regarding the session laravel's view rendering engine automatically caches your field usually it does a pretty good job of handling its own cache validation but if you ever notice that it's not working you need to run a new command called php artisan view colon clear to cache it and as you can see the compiled views have been cleared alright we covered a couple important artisan commands that you will be using in the future if you do like my content and you want to see more leave this video a thumbs up and if you're new to this channel please hit that subscribe button
Info
Channel: Code With Dary
Views: 6,592
Rating: undefined out of 5
Keywords: laravel, laravel 8, laravel php framework tutorial - full course for beginners 2020, laravel 8 tutorial for beginners, laravel php framework tutorial full course for beginners, learn laravel for beginners, learn laravel step by step, laravel full course, php laravel youtube, laravel tutorial youtube, how to learn laravel, laravel tutorial 2020 - the complete developer course, laravel tutorials from scratch to advanced, laravel artisan, basic artisan laravel, artisan commands
Id: u5AgUYbEWFE
Channel Id: undefined
Length: 6min 30sec (390 seconds)
Published: Fri Feb 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.