Laravel CMS | N-09 | Admin Registration

CoderOne · Beginner ·🛠️ AI Tools & Apps ·8y ago
Read Tutorial: http://go.ipenywis.com/ipenyf6751 --- Official Links---- Official Website: http://ipenywis.com Official Facebook: http://go.ipenywis.com/ipeny4907 Official Twitter: http://go.ipenywis.com/islem9a03 ---Support US--- By Becoming a Patreon: http://go.ipenywis.com/ipeny5024

What You'll Learn

Creates an admin registration system using Laravel CMS

Full Transcript

helping eyes of all were doing welcome to a new video on the series of making a content management system open-label so yeah we've been in the series for a real long time enough we have three still NEP good story and as of you have asks a lot of like asking me to do a new real stories on this series so here we are we're gonna just complete the series and create a bring you Vittorio's regard into the admin registration in the login and the authentication system on layer on how we can use the built-in authentication system for Mirabeau for your application to create a very flexible and reliable authentication system from the ground up so in today's video tutorial all we're gonna do is just gonna create an admin page so remember with the lower block transmission system the category page in here so just gonna go and implement the admin page we're gonna have two places where the table and we're gonna see the currently registered admins and we can be able to add the new admins through the forms so also we're gonna have like like the database setup and everything that we're gonna conquer this tree destroyer so as you have seen into the stories about adding new post and add a new category so it's gonna be like the same procedure with a bits line of changes and I'm gonna cover a couple of other more new things about literal and after that in the next video so I'm gonna cover the login and the authentication we're gonna create a login system we go from login restriction and login page whenever you put your like username and password if there right you can access if they're not just gonna like it do not let you access the deed the dashboard and so on and so forth so all of the things related to the long game we're gonna create them in the next we do Sawyer so let's just go ahead and start doing write that so make sure to open up the project that we have left behind the way back so if you don't have that project obviously you can go ahead in from github and grab the source code we have the full thing right there just going to clone it and install the NPM packages or the composer pretty much you're not using NPM in here the composer packages that you need as well as NPM and you are actually good to go now let's start by making happiness so the first thing we're gonna need to do is create the blade template for the add me page so using artisan or using PHP artisan so gonna go with IPA artisan me we're gonna create well not for that so they just go ahead and create this from here without creating any any like ridiculous things so just go ahead and do the pages and I've already done that actually so it's under admin table dot PHP make sure to put that into your pages into the views and you're actually good to go so this is the view of I'm gonna create two digit Astoria so you're gonna be like a very basic thing as I've said I'm gonna have two separate forms or two separate sections for that a page the first one is gonna be like the table but what allow us to see the currently we just City users the second one is gonna be the form that gonna allow us to add a new user to the database now let me just go ahead and grab that's the first thing gonna need is to extend from that as well so I have like a plenty of things like done in the behind the scenes so I don't like I don't want to make the video looks that much long so as you notice we have already covered a lot of things about that we have done this a couple of times so you should already know how everything is work out working in here so yeah you shouldn't actually see me doing that all the way around again because it's just like a very simple thing to do it depends on how you're gonna like put your page or structure of your page and the architecture and everything and for me I'm gonna just put a basic architecture in here with some kind of like custom classes and custom boot shop classes for using boost shopping it so in here we're gonna do is put like a column and be on a middle-aged eight section with a main admin ID and another container again the side that we have a table so with the class of bootstrap class table responsive so this is gonna like give us a responsive table and here all we're gonna do is just some logic for rendering things up so first we check for the counts if add means so this add means we're gonna like send it from the level so if you're familiar with the categories and the posts and all that so we're just gonna go ahead and grab the lock current admins to the blade and then the blade can render them here we're using the FCC's me just for checking that we are good to go whenever there is more one admin is registered or this one one month one Ottoman actually or more in this array so this is an array of gonna check if the count is greater than zero we're good to go she's gonna put in here a table row and in table headers so there's like a number or here you can put an ID or whatever so an ID and there's an is your name email date and hash password edits and the link so yeah you should be familiar with actually with the category we have all of that here but with a slightly bit of differences so here we have looking using and of course the admin gonna having a username also the admin gonna have an email gonna have a password and why happens named password only because it's gonna be like a hash password we don't want to allow the other users to see their passwords or their other admins password koley's or something so you can give them the hash password also when we store the password in the database we're gonna store it as a hash not the real stream password okay we're gonna have the created day days and the Edit interpolate no we're just gonna loop through the admins remember this is like an associative array you should all familiar with that you should be already familiar with that here we put in the first thing you're just gonna grab it admin from the array and we're just gonna like put the ID since this starts from 0 so we're just gonna normalize things up and give it or make it starts from 1 and here we have the admin grab the username grab the email created adds and the hash password so this is like only the template I'm gonna cover in you that I'm just gonna go through that pretty quickly since this is really basic and we've covered a couple of times for now and let me just go ahead and copy the last things in here I'm gonna have to copy all of this page actually says yeah I don't want to like waste the whole time on redoing this page this is just like a useful thing to do and in video 2 I'm just gonna go right into the needs of things and the most important things actually to implement and if you just show you and also let me just go ahead and grab the other ones now we need to put in the form so as I've said you should already be familiar you'll ever perform so little fo for him here so he only all that actually doing is putting another admin form div inside that is gonna open up a forum with a Ralph's we're gonna talk about that in a second we have a method of posts is we're gonna like add a new admin to the database which means the post HTTP method and we have like a couple of forms groups the first one is covering the username field or the username input field the second one is the email field third is a password and obviously if you want to like introduce your somebody to a database you're gonna need to confirm password this is like a very useful thing for you to do just making the users looks away much better than that so we have like a confirm password have password email and use your name now for the form group all we're gonna have like here's the text muted and it's the last thing I'll show you're gonna have like form submit button with some BD Nvidia success block and with an icon telling us like make sure you you're like you're submitting the correct information and all that so this is all gonna need to do for the template actually it's very basic very simple and yeah I forgot about this else like here we're checking if the count is greater than zero we render the table else if the count is less than 0 or equal most likely to 0 we're gonna just do is print out or give them a message telling them like no admins are available right now so just you need to add a new admins in order to see them being added into the table sometimes our fault so this is like the basic thing we need to cover in here and this is all we need to do for the admin tool blade dot PHP normal just go ahead and create the controller that given be like a responsible for controlling all of that methods and returning the index page and storing your admins the database and the any and all of the different things gonna be like added into the control no go just go ahead with PHP artisan and we can go with me controller and we're gonna have a new control in the unit's admin controller and make sure to put it as a resource you can do that it's like a very optional thing so yeah I just like doing that to make everything really fast for us now let's just go back under the up HTTP controllers and we can find that right over there so here we have our controller MC board or palettes controller and first we need to implement the index method the index method is gonna be responsible for fetching the admins are already existing in the database and just gonna return the admins array associative array alongside the view templates the admin table top HP's are just gonna be responsible for returning back the admins array alongside the template that I'm gonna render to the user and before that actually to make everything works we need also a model so the motor is gonna be like a responsible for fetching the admins from the database and adding them to the database like a model which is the schema that you're gonna like allow us to add to the database so use that as well HP on the same so we're gonna use that very quickly in here so I'm gonna make a model I'm gonna name it's an admin and then sits and that should give us an admin in here so if you can open up this here we got we've got an ID knowledge check the table the default table all that is gonna be like admins so let me just go ahead and use the protected table protected variable or the protected variable for the model and we're gonna change it to only add me I'm just gonna give it an admin and you and everything should pretty much be fine right now so going back in here let me just give it any clue that he's gonna be like indoor up I can't quite type things up so gonna be like up admin and here we go we've got everything now for grabbing the admin actually from from from the actual database all gonna need to do is just do some like ordered by and we store them under a variable so it can use the admin model and we're gonna order by I'm gonna order them by ID just bought just for different things and we're gonna just use the get method to get the whole thing like the whole array then here what we need to do is just to rejoin the view the view is gonna be like the admin or it's gonna be like under make you look on this yeah and their pages dots admin and means or yeah admins and this and I haven't put in the admin here only put it a variable and here we go so this is all we need to do for the index method in here now let's just go ahead and we just threw that into the round so this is gonna be like routes and we're gonna create a new round which is gonna be able to get requests and just gonna be like four slash admin and before going any further what we need to do as well for the admin page works perfectly and as well as the admin controller and added to the database we need to create the database table the admin database table so for that we need a migration so if you cannot remember migrations not gonna allow you to create a smooth tables without your knowing and whenever you're like a good point in to assure the my gracious is gonna run for you automatically without do dealing with anything like that yeah we need to create a new migration for creating the admin table so we'll just go ahead and use the power of artisan and we make migration we're gonna name this creates creates admin table yeah simple exists what we need is yeah this is this is all this but we need also have already made migration that's well that since you have covered migrations not much so yeah let me just remove and replace this Kevin and if can quite a notice that I've added in you F statement in here that I wasn't adding in the last video tutorials and that mainly because this one checks if the only if the table is already existing into the database or now so if it does it not gonna look at it we add it actually or try to re add it because trying to re add it just gonna give you a really weird error whenever you try to run the migrations later on and like while if it's not there it just gonna add it for the first time so oh you need to as well go for them on the other migrations as many recognitions as you have and add this statement so you cannot use the skimmer hash table method into the skimmer and you can give it to the table the table that you want to check for so this returns true if it does exist in false if it doesn't say we need to use the not you know what to tell it if this is not existing you need to have a table else just doing nothing in so on and so forth so yeah make sure to go ahead and do that because this is like a very nice for checking things up and if we try to run something if you try to run the migration a couple of more times and the tables already existing into the other base didn't give you a real a real weird error so yeah you don't mean like really need errors right now so he'll just go ahead and run this my branches using the artisan and we're gonna like migrate everything so here as you can see we only migrating the Queen on any table the migration not migrating the other ones because we have out of this F segment so as I've said it's very very helpful for you to use right now now coming back and let's just go ahead and do the web top PHP everything should be looking pretty much fine sorry just go ahead and refresh everything in here we should get best and if we try to go forward slash and we should pretty much we are getting actually error and arouse admin to store not defined yeah we haven't defined that yet let's just go ahead and get rid of it from now on it for a second so this is gonna be loud window black dot PHP and remove that since we haven't added the admin store routes yet we will do that in a second but let me just get rid of all of that or just cut it for now we have fresh that again and we should get that and as you can see we get no admins are available since the database and all the table the admins oatman's table has no admins for now and we get this really nice may not form the username email password and confirm password and we have this really nice registered opponent now let's just go ahead back and like put that back the store and everything let me just go ahead into our controller where there's the admin controller and we're gonna add well there's not the admin controller let me just go and look for the admin control here you want so I'm gonna go with a store and it just receives a request in here we need to store the admin to the database so as I've done that for a really long time for now so store into the database and near the area and a lot of things like receiving the request validating and then storing into the database or creating a new instance of the admin model then saving it to the database we've done that a couple times for now for the categories and the posts and all the bats so first we need to file the digs we do that quite a little launched so this we're gonna this holidays he would give it the request the first thing it takes as a parameter the second one it takes an associative array what it needs to validate so make sure to go ahead and grab the like form or the input names in here we have user name email password the before names actually make sure to grab them correctly unless this won't work for you so you give it a user name and what we need to do is just gonna like put it for a required as well as the well the user name needs to be a bounce like the max and I'm gonna be 50 the second one is gonna next an email so the email partially is gonna be required and also is gonna be like an email so you can put in here an email field telling is that this is gonna be like an email is the password where this is gonna be like required as well so the password is required and the confirm password is required so if you can go back make sure you grew up in the the rice naming year for the field for the input field and here you should put that in quite as well so yeah this is all ready to check for for the validation yeah this is the store method so now the second thing what we need is this we have like two password fields like the password and the confirm password so what we need is to check against both of these like we check if the password matches the confirm password then we are good to go and everything is pretty much fine we can register the user else if that if something like this is not matching between both of these password and confirm password we just return an error and telling him yeah the password and the confirm password needs to match in order to proceed with the registration so we are going back we can use the if statement and we can check between both of these so we can use the request and we can say since the request comes to that so we can say a password equals request confirm password so let me just check for the name of that yeah everything is taking too much fine and here what we're not is not gonna like check if it's right if it's not right it is strong what we need if if that doesn't match that we're just gonna return an error so gonna like first fire up a session so we can use our flash method for flying in a quick session one time only session given an error the second one is password or does not match yes symbols that's the second one we need to return an error with the back and we can send in with yeah look you something with input so the input is gonna be like the username request don't usually the password or not the passive actually the email we need to clear the password and confirm password field both of them needs to be cleared out so here we have the request dog email and here we go so we've got all of that together that's true pretty much let me just put a semicolon right there and here we go so this would just return it and just gonna fill us automatically the user name and the email inputs but I'm just gonna clear the password and confirm password fields so we save that we have covered that so now what we need is just go ahead and create an instance of our admin now since everything's pretty much working fine so far so I've reached this list like line of execution of code execution so everything's pretty much like working fine and we need to add this admin to the database so we just created instance for that we're gonna call this and that we know can increase in admin you ant me and having that much monthly or manually pretty much automatically so yeah let me just go ahead and have an admin the first one it takes is the username so it's gonna be like enter admin username or request username the second one admin password is going to be in the request the password and the last thing is gonna be well we have an email so yeah I shouldn't I shouldn't cover the password so what do you mean like that is like here any an email so the password as I've told you before that we're not actually going to store the password as it is like we have received one two six one two three four five six password we're not going to see or me we are shall not gonna show ever those guys we're not actually going to store it in the database like that's just like like this password we are actually going to hash it and store it then to the database so here we're gonna use some helper function under the likely Revolt illuminate package which is under support SADS and it's called hash so the hash class is gonna allow us to hash the password and store in the database so we can call hash make and it can hash us this password so we can store it under the database so simple as that now have success since we have a success we can fire our possession telling him a flashes section giving him a success message that's been registered successfully yep okay we need to return going back and we telling you that we have everything working pretty much fine and the admin husband which is to successfully to the database so this is all we gonna need to do for like adding the admin to the database one last thing I forgot about here is saved in the admin actually recall in here the save method so the save method responsible for saving this instance to the database and this is all we need to cover so just by putting the username email and hash you the password all over the way over there and yeah this is this is actually all we're gonna need to cover for now by storing the password now let's just go back into the web for PHP and klee that route responsible for routing to the store method into the admin controller so here we need like a post request it's gonna be like under admin for slash save or let's say and okay this looks pretty nice name let's go with for index index store and we can add in here a name to that to make it a little bit more clever so the admin dots store and this is all we need to cover so you can save that going back to the admin Doble dot PHP as you can see here we have the branch name which is admin dot store and the method is post so everything should be much looks pretty much fine now if you can go ahead and like refresh everything and let me just go ahead and take a look into the PHP my admin and we check for our database let's see if there is an admin table has been added for us or now and here we go we have an admin table we can just access that we get an ID username email hash password created at and updated as that has been added for us automatically by Louisville now we'll just go ahead and Avenue admin and you would say this is gonna be slam slam me calm and the password is gonna be like one two three four five six and one two three four five six for the confirm password register listen to the bottom and we've gets hash okay it's not it's not like that it called what is going on right here let me just obviously control those hash okay I miss putting the function but it should be hash no has go back okay let's just result me everything and we should get that yeah and this is us role it's not a password so this is a hash password I know I just can keep putting this ridiculous errors in this ridiculous mistakes I'll submit again now we should get admin we just successfully as you can see we get that admin user successfully and being showed us into the table so yeah very basic thing after fixing a couple of miserable errors we've got that and it's pretty much working so as I've seen as you can see actually guys is this very basic thing to do and we've a couple of days ago for the category in the past and the post and all that's the same thing goes for the admin and the registration the only thing is the password and hashing password an idiot yada so those actually guys pretty basic pretty simple and very flexible and the next video sorry I'm gonna cover the longing and the authentication system gonna walk you through step by step how walking works and Larry Bond how we can make it thumpin ground up for your application to like make a really nice flexible and were like reliable logging system through our so I will cut you all guys in the next video story
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from CoderOne · CoderOne · 50 of 60

1 Laravel CMS | N-01 | Getting Started and Environment Set Up
Laravel CMS | N-01 | Getting Started and Environment Set Up
CoderOne
2 Laravel CMS | N-02 | Routes, Controllers and Views
Laravel CMS | N-02 | Routes, Controllers and Views
CoderOne
3 Laravel CMS | N-03 | Dealing With Assets and Page Layouts
Laravel CMS | N-03 | Dealing With Assets and Page Layouts
CoderOne
4 Laravel CMS | N-04 | Migration, Models and Adding Categories
Laravel CMS | N-04 | Migration, Models and Adding Categories
CoderOne
5 Laravel CMS | N-05 | Showing Added Categories, and Session Messages
Laravel CMS | N-05 | Showing Added Categories, and Session Messages
CoderOne
6 Laravel CMS | N-06 | Edit\Remove Categories using AJAX and Popups
Laravel CMS | N-06 | Edit\Remove Categories using AJAX and Popups
CoderOne
7 Laravel CMS | N-07 | Add New Post
Laravel CMS | N-07 | Add New Post
CoderOne
8 Laravel CMS | N-08 | Creating a Basic Laravel Blog
Laravel CMS | N-08 | Creating a Basic Laravel Blog
CoderOne
9 HTML5 Canvas For Beginners | Getting Started | #01 with Webpack
HTML5 Canvas For Beginners | Getting Started | #01 with Webpack
CoderOne
10 HTML5 Canvas For Beginners | Drawing Basic Shapes | 02
HTML5 Canvas For Beginners | Drawing Basic Shapes | 02
CoderOne
11 HTML5 Canvas | Drawing Text With Circles | Part 01
HTML5 Canvas | Drawing Text With Circles | Part 01
CoderOne
12 HTML5 Canvas | Text Animation and Circle Collision | Part 02
HTML5 Canvas | Text Animation and Circle Collision | Part 02
CoderOne
13 Complete Guide To Web Development In 2018
Complete Guide To Web Development In 2018
CoderOne
14 AJAX & JSON Explained | Examples
AJAX & JSON Explained | Examples
CoderOne
15 Visual Studio Code Web Development Setup and Extensions
Visual Studio Code Web Development Setup and Extensions
CoderOne
16 Electron Build Desktop Apps HTML/CSS/JS - Getting Started 01
Electron Build Desktop Apps HTML/CSS/JS - Getting Started 01
CoderOne
17 Electron Build Desktop Apps HTML/CSS/JS | Creating Windows and Processes 02
Electron Build Desktop Apps HTML/CSS/JS | Creating Windows and Processes 02
CoderOne
18 Electron Build Desktop Apps HTML\CSS\JS | Dialog, Sessions and Cookies 03
Electron Build Desktop Apps HTML\CSS\JS | Dialog, Sessions and Cookies 03
CoderOne
19 Electron Build Desktop Apps HTML\CSS\JS | Custom App Menu & Context Menu 04
Electron Build Desktop Apps HTML\CSS\JS | Custom App Menu & Context Menu 04
CoderOne
20 Electron Build Desktop Apps HTML\CSS\JS | Package, Build and Deploy your App 05
Electron Build Desktop Apps HTML\CSS\JS | Package, Build and Deploy your App 05
CoderOne
21 Node.js Brief Beginners Introduction #01
Node.js Brief Beginners Introduction #01
CoderOne
22 Node.js How Modules Works & NPM #02
Node.js How Modules Works & NPM #02
CoderOne
23 Node.js Working With Events and Event Emitter #03
Node.js Working With Events and Event Emitter #03
CoderOne
24 Node.js File System (Read and Write) FS 04
Node.js File System (Read and Write) FS 04
CoderOne
25 Node.js Create a Basic Server Using Express 05
Node.js Create a Basic Server Using Express 05
CoderOne
26 Json Web Token Authentication JWT Explained Securing API
Json Web Token Authentication JWT Explained Securing API
CoderOne
27 CSS Flex Box Design | Practical Examples |
CSS Flex Box Design | Practical Examples |
CoderOne
28 API How It Works With Practical Examples
API How It Works With Practical Examples
CoderOne
29 MongoDB Getting Started 01
MongoDB Getting Started 01
CoderOne
30 MongoDB Working with APIs and Practical Examples
MongoDB Working with APIs and Practical Examples
CoderOne
31 Create a Command Line Interface (CLI) Using Node JS #01
Create a Command Line Interface (CLI) Using Node JS #01
CoderOne
32 Create a Command Line Interface (CLI) Using Node JS 02
Create a Command Line Interface (CLI) Using Node JS 02
CoderOne
33 Build React Apps | Introduction And Getting Started #01
Build React Apps | Introduction And Getting Started #01
CoderOne
34 Build React Apps | Working With Components And Multiple Rendering #02
Build React Apps | Working With Components And Multiple Rendering #02
CoderOne
35 Build React Apps | App State Management | Practical Examples #03
Build React Apps | App State Management | Practical Examples #03
CoderOne
36 Build React Apps | Getting Started With Flux (Intro) #04
Build React Apps | Getting Started With Flux (Intro) #04
CoderOne
37 Build React Apps | Create a Clock Timer Using React 05
Build React Apps | Create a Clock Timer Using React 05
CoderOne
38 Build React Apps | Create a Clock Timer Using React 05 | PART2|
Build React Apps | Create a Clock Timer Using React 05 | PART2|
CoderOne
39 CSS Preprocessors Getting Started | SASS and LESS | Practical Examples
CSS Preprocessors Getting Started | SASS and LESS | Practical Examples
CoderOne
40 Regex Introduction | Learn Regular Expressions 01
Regex Introduction | Learn Regular Expressions 01
CoderOne
41 PHP VS Node.js Which is Best For Web Development
PHP VS Node.js Which is Best For Web Development
CoderOne
42 Drag and Drop Using Native Javascript 01
Drag and Drop Using Native Javascript 01
CoderOne
43 Drag And Drop Using Native Javascript 02
Drag And Drop Using Native Javascript 02
CoderOne
44 Master Git (Version Control) in One Video From Scratch
Master Git (Version Control) in One Video From Scratch
CoderOne
45 Let's Learn The New Javascript ES6 Class Syntax
Let's Learn The New Javascript ES6 Class Syntax
CoderOne
46 Let's Create A BlockChain On Node.js
Let's Create A BlockChain On Node.js
CoderOne
47 Best Online Code Editors For Web Developers
Best Online Code Editors For Web Developers
CoderOne
48 Let's Create a Modern Login Form on React #01
Let's Create a Modern Login Form on React #01
CoderOne
49 Let's Create a Modern Login Form on React #02
Let's Create a Modern Login Form on React #02
CoderOne
Laravel CMS | N-09 | Admin Registration
Laravel CMS | N-09 | Admin Registration
CoderOne
51 Laravel CMS | N-10 | Login and Authentication
Laravel CMS | N-10 | Login and Authentication
CoderOne
52 Let's Create a Twitter Bot (Listen and Retweet)
Let's Create a Twitter Bot (Listen and Retweet)
CoderOne
53 Rapid Webpage Creation With Emmet (HTML & CSS)
Rapid Webpage Creation With Emmet (HTML & CSS)
CoderOne
54 Create Popups and Modals Using Native Javascript, HTML and CSS
Create Popups and Modals Using Native Javascript, HTML and CSS
CoderOne
55 Promises and Callbacks on Javascript With Practical Examples
Promises and Callbacks on Javascript With Practical Examples
CoderOne
56 Create Collapses using Native Javascript, HTML and CSS
Create Collapses using Native Javascript, HTML and CSS
CoderOne
57 Let's Learn Typescript (Javascript Devs) | Getting Started 01
Let's Learn Typescript (Javascript Devs) | Getting Started 01
CoderOne
58 Let's Learn Typescript | Interfaces and Generic Types (The Typing System) 02
Let's Learn Typescript | Interfaces and Generic Types (The Typing System) 02
CoderOne
59 Let's Learn Typescript | Work With Classes, Modules and Enums 03
Let's Learn Typescript | Work With Classes, Modules and Enums 03
CoderOne
60 Let's Learn Typescript | React and Webpack With TS 04
Let's Learn Typescript | React and Webpack With TS 04
CoderOne

Related AI Lessons

Up next
I Asked ChatGPT to Apply to 500 Jobs (8 Interviews in 48 Hours)
Sabrina Ramonov 🍄
Watch →