Laravel 7 Tutorial - Yajra DataTables

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone welcome back to the laravel 7 tutorial in this video we are going to learn about yasra data tables so let's see how we can create a yasra data tables in laravel 7 so switch to the project and this is the new laravel project okay so first of all let's configure the database to create a new database so just go to the low close php my admin and here just click on database now enter the database name let's say employee db now click on create all right data was created now just copy this database name and switch to the project and just open dot env file and here uh just add the database name okay so just paste here the database name username which is root and password password in my case is blank okay now save this file all right now install the azra data table package so switch to the command prompt and here first of all stop the running application and now run the composer command for installing yazda data table package so just right here composer required is yasra plus laravel as data table okay now press enter um all right now yazda data tables has been installed now make some configuration for the azure table data data table so switch to the project and just go inside the config directory so just open this directory and open the app.php file and here inside the app.php file and the providers okay for the yazda data table so just write here yasra slash data tables class data table service provider okay data tables service column providers class all right and also add here the aliases so just write here data tables and nyajra data tables data tables column column class all right now save this file now let's publish it so switch to the command prompt and here just write the command php partition vendor plan publish dashboards provider is equal to yazra tables slash data table service provider data tables service provider all right php artisan vendor column publish as provider is equal to yajna data tables data tables service provider now press enter okay publishing complete now let's create a controller okay so just right here php artisan make controller and let's say controller name is employee controllers so just right here into y controller okay now press enter controller has been created now let's create model and migration so just write here php artisan make model space model name which is employee also create the migration so just write here dash m okay now press enter all right model and migration have been created now switch to the project and just close this file and just go inside the database directory and then migration and open the create employee migration okay employee stable migration and here just add some column so just right here table and data type a string and column name let's say name right another column string a string and column name email dollar table and here okay a string a column named phone caller column name salary okay one more column department just right here table let's train department all right now save this con migration file just copy the data table name and go to the app and then just open employee model okay and here add the table name so just right here protected dollar table is equal to this okay employees now add the fillable column so just right here protected the label is equal to array and here just add element name email on salary and department all right now save this file and let's migrate this migration so switch to the command prompt and here just type the command php artisan migrate okay now press enter all right migration has been migrated now you can see here inside database just refresh the database and you can see here the employees table and these are the columns okay now let's insert some records into the uh into this table so that just create a factory so inside the command prompt just right here the command php artisan make colon factory and that's the factory name is employee okay also state the model so just write here model and model is employee all right now press enter factory created successfully so just open it so go inside the database directory and inside this factory folder you can see here the employees factory okay so just open it and here just add the name arrow sign dollar fixed arrow name okay for the email just right here the email and dollar faker arrow email all right phone dollar fixer arrow phone number right and for the salary dollar picker just call the number between function and here lower limit twenty thousand up limit forty percent okay now at the department so just write here department arrow dollar figure and inside this array is equal to array and pass right here some element let's say accounting marketing sales and quality management all right now save this file and run this factory so here okay okay and here the function name which is random element okay random element okay now set this file here now run this factory so switch to the command prompt and here just run that tinker so just write here php artisan thinker and here just right factory and wrap last employee and let's say create 100 records so right here 100 create okay now press enter all right records are created let's check inside the table so just refresh the table and you can see here the records okay these are the 100 record okay total records 100 now let's create data table okay so in command prompt exit then clear the screen and here for creating data table just right here the command php artisan okay now press enter data table created okay so just open this file click on app and inside this app directly you can see here the data tables just open employee data table okay and here inside this get column function just to remove all here from here and add the column name let's say column name is id [Music] name email phone salary and last one department all right and from here just remove this buttons and also remove the dom dft the frt okay this one now save this file now go to the controller so just go inside http controllers and just open employee controller okay and here at the function so just right here public function in the function name let's say index and here just pass the parameter which is employee data table okay and here at use app slash data tables and employee data table okay now space dollar data data table okay and inside this function just simply return and write here data table hello render and create ahead of the view name let's say view name is employee okay now save this file and let's add the route so go to the web.php file inside the browse directory just open web.php and here create a route right here without hit and uri which is employees controller name by controller and function name index okay save this file and now let's create this view inside the views directory so just open resources views and here create a new file employees.php okay now here first of all write html5 boilerplate so just type exclamation sign and please tab now change the title here so just write here data okay now add here the cdn of bigquery bootstrap and data tables okay so go to the browser and just open google and here simply search bigquery cdn okay now click on first link and from here just click on minified now copy and paste here all right now go to the url get bootstrap.com click on get started and from here just copy the css and paste paste here all right now copy the js and press paste here all right now remove this bigquery mean jquery slim dot mean version okay so just remove this all right now open new tab and just write here the url which is cdn dot data table okay and here just click on go to step 4 now copy this css and just here so first of all at the link tag and inside the href just paste the eval all right now copy the js file and here and that's encrypted script colon src just paste here copy this one script and just paste here all right now inside the body just right here and the container then row and then column just write your column amd 12 okay and here just add the single curly bracket and exclamation sign and here just write dollar this variable name data table arrow table okay and here just before the closing body tag just right here curly bracket exclamation sign and data table a script okay now save this file so all set so let's check it so switch to the browser and here just go to the url uh first of all run run the application so just right here php article all right now go to the url in twice press enter okay and you can see here the data tables all right this is the pagination you can search from here just like type any text all right okay and you can also use the size from here and record 25 50 100 if i click on 50 you can see here the 50 reverse okay so in this way you can use the azure data tables in laravel 7 so that's all about the azure data tables so thanks for watching this video and if you still have any kind of question you can ask me in the comment box don't forget to subscribe my channel thanks for watching
Info
Channel: Surfside Media
Views: 7,022
Rating: undefined out of 5
Keywords: How, to, Program, laravel (Software), laravel, laravel v7, laravel 7, laravel project, laravel setting up, laravel v7 setting up, laravel v7.0, v7.0, laravel 7.0, laravel 7 playlist, laravel 7 tutorial, laravel 7 lesson, laravel 7 introduction, intro to laravel 7, laravel tutorial, laravel 7.0 tutorial for beginners, laravel for beginners, laravel tutorial for beginners, yajra datatables in laravel 7, datatables in laravel, datatables in laravel 7, laravel 7 datatables
Id: 2xFpblty3Yc
Channel Id: undefined
Length: 23min 30sec (1410 seconds)
Published: Thu Aug 27 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.