‫All right.
‫So I'm logged in at the moment because I registered a user, it got added to the database.
‫And then we created a session on the server.
‫And it has the key of user.
‫So there's no visual representation of me being logged in right now.
‫So that's what I want to do is to have the login and register links show if we're not logged in, and
‫then have a log out link and the post job button.
‫If we are logged in.
‫We can also even put a message that says welcome in the user's name because the user's name is in the
‫session.
‫So let's go into app views, partials and nav bar dot PHP.
‫So from here basically we're going to go into the nav.
‫So into this nav with the class of space x four.
‫And we want to have an if statement.
‫So we want to check we want to use the session class.
‫And the has method to see if there's a session with the key of user.
‫Now you can do this one of two ways.
‫You could just say framework slash session and then has and user.
‫So if you want to include framework here you can.
‫But I'm going to use this in a couple of places because we're also going to get the username.
‫So I'd rather put it up here.
‫But I mean you might not want to because it's like a template.
‫It's mostly HTML.
‫So it's really up to you.
‫I'm going to go ahead and just say up here use.
‫Framework session and then not include the framework slash.
‫All right.
‫And then let's see I'm going to just go right here and let's do a PHP ls.
‫And then let's end it.
‫So PHP end.
‫And if.
‫Now the the login and register links.
‫I'm going to cut those.
‫Those are going to go in the else.
‫So basically if there isn't a session meaning we're not logged in.
‫And then this button here the post a job, I'm going to put that in the if we are logged in, because
‫there's really no sense in seeing the button if you're not logged in, because you're going to have
‫to be logged in to post a job right now, you don't have to because we don't have that functionality,
‫but we will have to be in the future.
‫All right.
‫Now.
‫Before this.
‫This a tag the post job button.
‫I want to put a log out and the log out is going to be in a form.
‫So let's add some form tags and then we'll have a button.
‫It's going to have a type of submit.
‫And we'll say log out.
‫And then I'm just going to add some classes for styling.
‫So let's say text dash white.
‫In line and I'm going to say on hover.
‫Will have an underline.
‫All right.
‫So actually, I think I messed that up.
‫Yeah.
‫We want we want this lined up.
‫So let's actually wrap that logout button and the post job button in a div.
‫And we'll give this a class of flex and let's say justify dash between.
‫Items dash centre and gap dash for.
‫And then we'll move the form and the link into.
‫Into that div and that should line it up.
‫There we go.
‫Now it's up to you if you want to do this, but I'm going to just have a welcome and then the user's
‫name.
‫That way we know who we're logged in as, so we can do that by creating a div.
‫And in that div.
‫We'll say welcome.
‫And we'll use the shorthand syntax here and just say session.
‫And we'll use the get method.
‫And in here we want to get user.
‫Now remember this is an array right.
‫It's an associative array.
‫So after that I can put brackets.
‫And I can access any of the fields I want.
‫And I want to get the name.
‫So now if I reload we get welcome Brad Travis.
‫Right?
‫And I mean, if you wanted to add a profile page, you could have this as a link that goes to the profile
‫page.
‫We will be doing that in the Laravel course at least that's my plan for now is to create this application
‫in that course, which is coming in a few months, and add a bunch of new functionality to it, because
‫a lot of the stuff is already done for you.
‫Just having basic functionality, building it with vanilla PHP is much, much harder than doing it with
‫Laravel.
‫So yeah, so I probably won't have that functionality in this particular course, but at some point
‫I will in another one.
‫All right.
‫So I think that's yeah, that's all I really wanted to do.
‫Now we want to be able to log out.
‫So we'll do that in the next video.