Laravel CMS | N-05 | Showing Added Categories, and Session Messages
Skills:
Project Management Foundations80%Delivery Management70%AI Tools for PMs60%Prompt Craft50%Advanced Prompting50%
Read the Written Tutorial on the Main Website:
http://go.ipenywis.com/ipeny4429
--- Official Links----
Official Website: http://ipenywis.com
Official Facebook: http://go.ipenywis.com/ipeny4907
Official Twitter: http://go.ipenywis.com/islem9a03
Official GitHub Repo: http://go.ipenywis.com/ipeny5c0e
---Support US---
By Becoming a Patreon: http://go.ipenywis.com/ipeny5024
What You'll Learn
The video demonstrates building a content management system using Laravel, displaying saved categories, and managing session messages. It covers various tools and techniques such as Bootstrap, PHP, CSS, HTML, and Laravel's session management.
Full Transcript
hey guys all who are doing welcome to the fifth tutorial on literacies of making in control management system some people may cause a content management system but it's the same thing so here we are in the fifth one if you have already watched the couple for tutorials on the series please make sure to watch them for continuing in DC and the series because this really matters you have to understand some basic things before getting up with the fifth one so here on the fifth one we're gonna talk about how we can display our already saved categories in the database like we have done on the last one let me go into here make sure to check out the website up is calm and we go to the category in the last videos stored on the fourth one we have talked about the models and migrations and how can allow you to create another category so let's now try to like test in category and push the other category but we won't be able to see if that category has indeed in at the database or there was an error or something so we don't have like a successful run error messages and we will implement that user decisions as well this particular soil as well we can check out the already registered categories and that therefore we have to create a table that's pitch from the database the available categories on there so we're gonna use the power of moisture our for styling this or for making that's easier for us if you you can feel free to use any framework on CSS framework you'll like for designing of things and for professional side you will like design this point yourself from making if you were really intended to make a big control management system anyway like jump into the kimchi category blade but PHP and on there you can see the form that we have done the last last time let me just remove this button because I've just added this to the last time for testing so no need for it right now let me just come in this house and as you can see I have already out of the dev this cardboard is tabled and the class is table responsive and this table responsive is a bull shark class which makes our table looks really responsible so let's create a table so that also gonna have the class of the table also a bull shark class and which drop is already being ship it with Li revoir right out of the box so you don't have really to do anything like you don't want to include this or you don't need to include this it's already has been done for you table now we need to other the table row for this this point things at a bar are gonna have the first thing is an ID of this category so the idea of the category gonna be something like table so I'm gonna either might be okay can't type honey don't you know why so the ID of one's gonna under the category this one is gonna be the name and also the creator to name we're gonna give it two shortcuts for an author you can name it author anyway and we need time stamps like updated tasks and created us and this already has been does for us from glare bow itself all it talks about this in the last video tutorial so we have created at updated and so for updating the category we're going to cover in the next video tutorial Ajax calls and how you can use them alongside the pop ups a model pop up which allow you to move or it does or edit a category and I'm gonna use this a lot on like posts and stuff other things you might need admins registrations users whatever so it's gonna be very hopeful for us other button is gonna have like the edit and remove as I've said so I'm going to use an a for this job and I believe I'm gonna remove the a child you're gonna use a span this pan I'm gonna has a class of a BT and BT and - a warning this is for the edits I'm gonna call it just edits oh no no no we we only want to include the button here we're just gonna say this is gonna be emitted so we're gonna call this edit and another one is gonna call it remove so this should be we need for the table row and the other table row we're gonna put our data so the data we're gonna have is our category data so we're gonna put the economy name the author name of the category decreed it adds and the updates add and we need to get those from the database so for that we need the variable holds all our of categories so we can loop through all these categories in here so therefore little give us an option to do or to pass in the data from the controller into the view so therefore we go into our index sqg i've already done this so there's a category is a category order by and we get all the categories that has been saved and on the database on our categories we are when we used a model of us up category then we say the categories then card with this ordered by function gonna order your categories depending on a factor and this pattern I'm using the created adds you can use also the updated out but clearly that is a bit more autonomy creditor then the updated us on this particular case and we have the descending order then we use this gets method to return of the array of the categories available on our database then with the width method on the view we are passing in the categories the array of the categories into the view or into the HTML file itself in order to render it out so use this width will put the key and the value pairs on those so if you are intending to put a multiple like variables again you can use an associative array look you can say can't see already here and you put the anything like here a variable and puts another camera another variable area yadda but here we are have only one categories so no need for using it an array actually as I've said the categories now we are passing in the Gouri enjoy played category to play dot PHP and now let's go ahead and make sure that this categories are not empty like this array has at least one category or more so therefore gonna use an if statement and blade engine give us a really powerful thing rather than just using like PHP like styling the beach or opening the PHP and saying F yada yada yada do this do something blade all it can do this for you with a really shot cut state statement you can use hot F and this is gonna do the same as using the F and do the PHP tags so it makes your life easier that's why I told you about blatant which is gonna make your life way much more easier than you can think so we as you you might use it as a normal F statement so we use the counts method or the count function since it's not part of class so the counts function I'm gonna use the categories since we have already passed the categories into our place so they are available right now categories and we say if this the count is greater than zero then you can render this else we're gonna display some measured like there are no categories or the categories our empty please added a category first yadda yadda yadda you can do this let me check out all of this let me out of this before the table so you just peace okay I'm gonna other this before the table so if there would be no categories in our database we want render anything in here just a message telling the user that the categories no categories are available for the moment he needs other category first so for ending if there's no curly braces in here so you have to type that and if samples last is very easy very simple very straight forward so let me just get rid of this space in space in space and now since we have checked now we need the for loop and also played provides us with an easy or shortcut rather than using the normal fourth or the for each from the PHP you can do this by as and say for or for each we're gonna use for each for easier thing for this particular case so we're gonna take categories and we are looping pass at category and we want to get the index for the ID in here as you can see you want to display the index of this category so therefore we can use the key key value pair in this for each if you didn't know about this yeah you'll be able to use it I'm gonna call this I and you can use the equal sign and the left arrow to represent of value or key value pairs so here we are looping and let me just end with the whole group so we tell it in for each as simple as that then intermediate we're gonna put our data so a table or now the table details aren't gonna put and use the double curly braces as a sports what I've said in the last video to like echo thanks like echo text like oh variables from the PHP into the HTML well then he was e PHP echo you can use this double curly braces and then close them so like echoing we're gonna use our variable plus 1 2 to get rid of the 0 and that's so another table row now we need the as we have specified in here this is the category so we need to put the category name also one can use the double curly braces then frozen again I'm gonna say category and they make sure to use this simple version this category not the categories because in array of a category of categories actually and another table details the authors category and as well we're gonna say the often we have main if this is the author in our database of the column of another so as well we're gonna get the created ads and the updates are timestamps so gonna be very simples well category related ads now couple keys or a capital case Wow okay update in us okay then the buttons that we all spoke about so we need an edit button and remove button that we got me to benefit from or show you how to use the Ajax wheeler about in the next video so sorry I'm not going to use this then just use a button gets rid of the hrf and the span other to span at a class of the bottom so this class is a bootstrap class that gives you over the nice button I'm gonna use the warning okay I'm gonna put the new edits I'm gonna just copy pitch this for easier integration okay I'm gonna put this okay this is gonna be info or not invoke danger because we're gonna remove a category and yeah we're gonna talk about s'more deeply on how to use both of these and why they are very important to do them like this or to quit them like this specifically and why we need them so like well loop in and we're fetching everything now which account if everything is working fine you can it's not strictly you don't have to use tables for rendering the data you can use any style you want or any containers you wanna put your data on like in the dashboard now as you can see we have artistic category that you have just add and the web development category now you can use the remove here and the edits which we're gonna explain the next video tutorials you can see the critical tasks and the updates time since also are available and the author is default author islam famous now if we try the account according so it is gonna work fine with no issues hopefully you can see it's gonna reload and out of the category and as you can see it's the first one so since or its ordering by the created adds a descending so we have covered out this but we still we have an issue that we won't be able to know if this category has been unsuccessfully that we are now giving no messages like a success message or and an error message if an error has awkward in the backend like in the server so we won't be able to do with that there is a session a session variables if you don't know a session musician here's kind of when you open up a website on the server back-end you're gonna create a session it's always specifically for you you can store your cookies this one you can install your cookies and the session gonna be destroyed up you close the website like it has a timeout so this is what I mean by a session and also lerigot provides us with a default session so it's create a session for you to protect you from like a couple of famous attacked like X CSS and stuff we're gonna use them in the next tutorial explaining them why you need to use them or how to type ask them for an AJAX for birthday okay now we need to go ahead and create end of the include our views include and we need to create a new folder or not your folder action a new file just a new plan and i'm gonna cause messages or messages unless geez blade quiet the top is not working some reason okay play stop PHP you're gonna open up this and this will be our gonna use our messages system and the session and also verbal has a built-in variable called errors that display the errors has been awkward in the back end or on your surface so it can tell you if any error has been awkward or now therefore we're gonna check if the errors we're gonna also use the top plate someplace energy for checking out I'm gonna check if the variable is called error and I believe just know I'm gonna use the count counts the error cell is in error accounts errors and they greater than 0 so there's there's an error I'm gonna end the F I'm gonna render out the errors in here so we're gonna say there our class of large a lot danger cocinero certs danger are using again a boost track classes in here as well we're going to get the errors and we need to look through the errors in here so I'm going to do four for each lowers us say for each symbol and let me just indent the Kelvin here to make it looks a bit read the ball and now we're gonna display our there now for looping we can't just tell it like this because this is not array this is a little collection class so to get the array use the method called all to get all on all the areas without still doing like without ordering them or something so this is how you can you could take check this out by typing in Google label collection and you can see or see all the available methods in there it's really really nice it's gonna help you a lot organizing your data in the database as well as like ordering them while we're doing them to be users now we're gonna call the error this one and obviously this is gonna be it so now let's cover up the session and the session we're gonna check if the session exists so to use that is a helper method called session or the available for us just session I'm gonna call as position let's say the session error is we're gonna return an occult arrow and the success with a capital e and a capital S so error F session error cannot and F here so you cannot use it like this session is so the session error if that session is being available so we have just just been resolved plus I've done the first one so we're gonna use a lot a lot - danger because this is an error we're gonna just choice to print out this session copy paste this okay sorry okay and what's going on okay we're gonna cover up the success now let's test this out by returning session when we added the category now by going to the category controller under store like well coupled up in the last video tutorial restoring just a category and on database now after saving it gonna like success save it successful just gonna return a session so to do that not actually returning it but selling a session variable so use the session miracle help session I'm gonna call it success or no we need to use the flash method so-called flash method now put a success that puts our category named and we're gonna put the name either the SAS holy okay I'm gonna put the category name between those dots and we're gonna get category okay this is should be working and while we're specifically using the flash method in here because if we don't use it the session variable would never be destroyed like you you're gonna keep seeing or seeing this where all this modification over and over whatever you refreshing the page you're gonna keep seeing seeing modification up there so using the flash you're gonna see it only once when it's reload so the next reload on the second reload the the this variable gonna go or gonna be destroyed from the session variables storage therefore now it is the Sox before this let's include this in our up so let's go to the up mainly on top so we have sinkhole this in order to make it takes event and before or after this model think you gotta cover it in the next video tutorial so I've just done some couple of tests in here to make sure like everything is working fine anyway it doesn't don't take care about this okay so we're gonna include okay implode and it's under our include dance and it's called messy cheese stop not going for the top play pop PHP so they called messages let me just double check that everything is working fine now let's try to refresh and try to under the category and see what we can get in here so hopefully we'll get some more messages I don't know look at something as you could see category name it cats that successfully and you can like make this floats in here by changing the style of its because I'm gonna make you CMS works bit better I don't know I'll try to make to solve this if I have the time but I don't think it's just working fine up here also you're gonna get the errors if there would be any errors up here I guess this is pretty much it for the sessions just a simple stab you can get a decision variables so we've covered up the category and the sessions and how to display them on how to return them so this is the guys for this tutorial think us watching hope you will enjoy gonna cover in the next story Ajax call and how to use this remove and edit method and listen moving edits patterns to the categories available in here this pretty much just see you in the next video zone
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from CoderOne · CoderOne · 5 of 60
1
2
3
4
▶
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Laravel CMS | N-01 | Getting Started and Environment Set Up
CoderOne
Laravel CMS | N-02 | Routes, Controllers and Views
CoderOne
Laravel CMS | N-03 | Dealing With Assets and Page Layouts
CoderOne
Laravel CMS | N-04 | Migration, Models and Adding Categories
CoderOne
Laravel CMS | N-05 | Showing Added Categories, and Session Messages
CoderOne
Laravel CMS | N-06 | Edit\Remove Categories using AJAX and Popups
CoderOne
Laravel CMS | N-07 | Add New Post
CoderOne
Laravel CMS | N-08 | Creating a Basic Laravel Blog
CoderOne
HTML5 Canvas For Beginners | Getting Started | #01 with Webpack
CoderOne
HTML5 Canvas For Beginners | Drawing Basic Shapes | 02
CoderOne
HTML5 Canvas | Drawing Text With Circles | Part 01
CoderOne
HTML5 Canvas | Text Animation and Circle Collision | Part 02
CoderOne
Complete Guide To Web Development In 2018
CoderOne
AJAX & JSON Explained | Examples
CoderOne
Visual Studio Code Web Development Setup and Extensions
CoderOne
Electron Build Desktop Apps HTML/CSS/JS - Getting Started 01
CoderOne
Electron Build Desktop Apps HTML/CSS/JS | Creating Windows and Processes 02
CoderOne
Electron Build Desktop Apps HTML\CSS\JS | Dialog, Sessions and Cookies 03
CoderOne
Electron Build Desktop Apps HTML\CSS\JS | Custom App Menu & Context Menu 04
CoderOne
Electron Build Desktop Apps HTML\CSS\JS | Package, Build and Deploy your App 05
CoderOne
Node.js Brief Beginners Introduction #01
CoderOne
Node.js How Modules Works & NPM #02
CoderOne
Node.js Working With Events and Event Emitter #03
CoderOne
Node.js File System (Read and Write) FS 04
CoderOne
Node.js Create a Basic Server Using Express 05
CoderOne
Json Web Token Authentication JWT Explained Securing API
CoderOne
CSS Flex Box Design | Practical Examples |
CoderOne
API How It Works With Practical Examples
CoderOne
MongoDB Getting Started 01
CoderOne
MongoDB Working with APIs and Practical Examples
CoderOne
Create a Command Line Interface (CLI) Using Node JS #01
CoderOne
Create a Command Line Interface (CLI) Using Node JS 02
CoderOne
Build React Apps | Introduction And Getting Started #01
CoderOne
Build React Apps | Working With Components And Multiple Rendering #02
CoderOne
Build React Apps | App State Management | Practical Examples #03
CoderOne
Build React Apps | Getting Started With Flux (Intro) #04
CoderOne
Build React Apps | Create a Clock Timer Using React 05
CoderOne
Build React Apps | Create a Clock Timer Using React 05 | PART2|
CoderOne
CSS Preprocessors Getting Started | SASS and LESS | Practical Examples
CoderOne
Regex Introduction | Learn Regular Expressions 01
CoderOne
PHP VS Node.js Which is Best For Web Development
CoderOne
Drag and Drop Using Native Javascript 01
CoderOne
Drag And Drop Using Native Javascript 02
CoderOne
Master Git (Version Control) in One Video From Scratch
CoderOne
Let's Learn The New Javascript ES6 Class Syntax
CoderOne
Let's Create A BlockChain On Node.js
CoderOne
Best Online Code Editors For Web Developers
CoderOne
Let's Create a Modern Login Form on React #01
CoderOne
Let's Create a Modern Login Form on React #02
CoderOne
Laravel CMS | N-09 | Admin Registration
CoderOne
Laravel CMS | N-10 | Login and Authentication
CoderOne
Let's Create a Twitter Bot (Listen and Retweet)
CoderOne
Rapid Webpage Creation With Emmet (HTML & CSS)
CoderOne
Create Popups and Modals Using Native Javascript, HTML and CSS
CoderOne
Promises and Callbacks on Javascript With Practical Examples
CoderOne
Create Collapses using Native Javascript, HTML and CSS
CoderOne
Let's Learn Typescript (Javascript Devs) | Getting Started 01
CoderOne
Let's Learn Typescript | Interfaces and Generic Types (The Typing System) 02
CoderOne
Let's Learn Typescript | Work With Classes, Modules and Enums 03
CoderOne
Let's Learn Typescript | React and Webpack With TS 04
CoderOne
Related AI Lessons
⚡
⚡
⚡
⚡
I Asked Gemini AI to Preview My Haircut Before My Salon Appointment - Here’s What Happened
Medium · AI
7 Best AI Tools for Research, Coding, and Development in 2026
Medium · Data Science
7 Best AI Tools for Research, Coding, and Development in 2026
Medium · Programming
How to Write a Project Status Report With AI in 15 Minutes
Medium · AI
🎓
Tutor Explanation
DeepCamp AI