Laravel 5.2 PHP Build a social network – Setup & Introduction
Video Title: Laravel 5.2 PHP Build a social network – Setup & Introduction
Hey everyone now in the last week’s I had a lot of angular2 stuff going on on this channel and while I really enjoy Englert you and I work a lot with front-end frameworks on my client projects I also worked a lot on the server side when I create well server
Side projects and I’m not talking about setting up restful services or anything like this I’m just talking about yeah blind simple websites which have their code on the server written in in my case PHP because I mostly work with PHP and that’s the point I want to talk about
I’m using lateral which is a very modern and not too old and very cool PHP framework I’m using in my projects now thought it would be a nice idea to to share some videos on level 2 because hey there might be people out there who want
To get into level or who just want you up their development skills or what they can do a little bit because if you’re just able to write PHP well you will have to do a lot of work on yourself that a framework will already solve for you probably safer and overall in my
Opinion it makes developing websites a lot more fun and you wouldn’t be able to have a complex project if you weren’t using a framework of some kind doesn’t the PHP framework could also be Ruby on Rails but yeah frameworks are there for a reason and so we should use them now
In this video and the next videos will create a nice little lateral application which won’t be too complex but which will always showcase some of the strengths and of the main features of laravel so we’ll create a little social network so to say where we can on the
One side sign up and log in and then post things and ready to read like a global timeline of all people where we then can just like or dislike there posts so kind of a Facebook Twitter mix you could say I guess so I’m going to start by installing lateral which is
Really easy I assume you already got a development environment that means you got a web server PHP interpreter and MySQL if you haven’t and description below you’ll find some links which will get you started and you will see it’s really easy to install packages which include
All the things you’ll need so as I said I assume you already gathered in one open environment so let’s just dive in install laravel and get started with our app oh and by the way I don’t have the app finished as now so I’m doing that blindly with you together because I’m
Pretty sure that is where you learn the most or where you can see making me mistakes or yeah sometimes not being 100% consequent and you’ll see hey that is the thing I have to watch out for that is something which ya can’t get overlooked easily so see you in the
Videos heroine so I’m finally sitting at my desk and before I get started a little information for all the people who already know a little bit about laravel who are familiar with how to set up laravel and move the food structure flare well you might want to skip ahead
And you will find a link up here which will get you there because now the beginning will I will quickly install their amo and then I will yeah talking about the folder structure and Hilaire over it’s just a quick quick very quick roundup so you may skip ahead and then
We’ll meet later in the video or we’ll start with our real application see you there then for all the people who are still there now be aware that as I said at the beginning of this video and the setup of your development environment will not be included in this video but
You will find useful links in the description and I promise it’s really isn’t easy to get going now I’m here in my empty folder and I will install level through my terminal using composer now if you don’t know what composer is and you probably don’t have it then just
Google for a composer and on get composed record you’ll be able to to download it and yeah as a here composure is really just a dependency manager for PHP so favorite line like level but also a lot of packages they state which dependencies they have because the guys from wearable
Didn’t write all the code themselves they used existing packages and then the compute ate it in like a special file adjacent files specifically and composer is a software which will then scan through that file find your dependencies find them in the internet the most recent version or a version you
Specified in your file and download it get everything in your folders that you were ready to start so a really really helpful tool for for managing your dependencies I already have composer but if you don’t as I said just download is here follow the instructions you see
Here and you should be good to go now what I’ll do I’ll just open up my terminal here and I will execute composer create project another project is lateral slash level this will install it and I specify prefer just to make clear that I wanted to be downloaded and
Installed on this folder here so now composer will get going and as you can see it is now installing level and it’s yeah it’s fetching it’s downloading all the dependencies I’ll need and that will take some time so I’ll see you once this is finished so
My setup just finished and if I just RiRi let us refresh this over here we can see that we get all these files and folders here now they’re inside the lateral folder that’s just a default and I would just move them up one folder I simply do this by typing MV for move
Laravel all everything that isn’t an aural folder just dot just to the current folder so yeah that worked and now I can I must check hurry up now that left out there is dot files here those are important too so let’s just manually move them up so that my lateral folder
Is actually completely empty now that should in theory work yeah so now I can get rid of malarial folder here and now I’m good to go now if you see if that worked you want to fire up your your browser and navigate to wherever your local development environment is bound to sell
So Evert you specific host if you bound to that so wherever you normally navigate for your projects and there you wanna navigate navigate to your little folder and then you have to target the public folder that’s important if you’re a URL or if you’re just navigating to
This level folder you won’t see anything or just an error because level is serving it’s files from this public folder so another way would be to set it up such that your server is already pointing to the public server and all your application files so to say our one
Directory above so that will be how you set it up on a web server so I’ll go to my file here and now you should see this lateral five message which means hey it was successfully installed now by the way if that was a little bit too fast
For for how to set all that up again please look in the description there will be useful links provided there let me clear a step and that is our very first level application let default we see when it’s starting up now that be quickly guide you through all these
Folders and files we got here we got a rap folder this is where we will write the majority or a bit all our business logic will live in this app folder we will that about routing or control us in this folder the bootstrap folder is something
We won’t touch most of the time the config folder we got several parts of our lateral application which we can configure like for example the offering authentication package or general configurations for the whole app at the moment we don’t have to do anything here in the database folder there we can use
A very cool feature of Larry law namely one to create database migrations which are PHP files which define or declare how a table in a database should look so which feels it should have and how these fields are configured so stuff you normally would do either through like
Graphical interface like PHP myadmin or directly through SQL in this case we can write a PHP file and then use the lateral command line tool which we’ll see soon and to execute that file and that will create all that the sequel code we need and will automatically
Write it into the database so very easy and intuitive way of setting up database so that’s that’s one of the greatest features in my opinion of flair well a very great feature at least the public folder is something we won’t have to do much there however we will soon set up our source
Directory for our CSS and JavaScript files in our recent resources folder well we got this assets folder where we could use SAS or SPSS if we wanted you and Laurel ships with a default galled file here and the app CSS file so if you
Want to use it it’s kind of built in but I will get rid of that and I will use even my own a gulp file on my own gulp workflow or I’ll just in this toilet just write pure CSS so but we could use this assets folder to have dread up I
Mean compiled version of our CSS and our javascript and setup our god workflow or whatever you’re using to copy them into a source folder in the public directory that the language folder the land folder we can set up translation yet file so to say so if you look in one of those files
It’s basically an array which has a key and then the text to be displayed and they could specify additional language is here obviously and we would have to need each file and each key then for every language you want to specify so that we can provide a perfect
Translation but we’ll stick to English in in this application here now the fuse folder that’s a very important one here we will create or refused so what gets rendered to the screen lateral ships with its own templating engine the blade templating engine that’s why this file is called blade dot PHP and that’s
Basically just a templating engine yet like you might know others like smarty for example where you create your fruit views from several components which are then stick together and you have a very structured way of accessing data you might pass into those views so that’s a cool thing to Alera
And all our fuse will live in this fuse folder here as you can see it currently has this welcome view which if we have a look at it it’s just has level 5 and that’s exactly the few were seeing here it also has I think one year one error a
Few it already has defied and here in this vendor folder if we were to install additional packages those packages might publish views which are part of the package which would then go also in that vendor folder where we could edit them if we wanted you because we should never
Ever end that as the vendor folder if I briefly skip those two I’ll come back to them in a second in the vendor folder all our dependencies live all the packages were using live including the labral framework oops including the laravel framework itself you can see it here
And we never never want to attach anything inside here that are the files s they were installed by composer and those will only be changed if we run composer update or anything like this yeah we might install new and also remove unwanted or unnecessary packages but we
Should never mess with any content here because it will be overwritten if you run an update and we don’t want to do that also if we mess something up there it might be very hard to find that out so most packages or old packages that want you to added stuff will add a
Possibility for you to use a certain command in the level command line interface I will show you that in a second which will publish all the things you should be able to change into one of those folders here so that’s very important to keep in mind now the
Storage folder here that holds yeah for example the cache of your app and yeah that s generally it also some files might be stored there as what the name says it’s a storage and tests folder well that is if you’re running unit tests well you will do that in that test
Folder so that’ll fit all the folders let’s briefly talk about those files and don’t worry I’m not going to go through every file to be honest I’ll only talk about two files the first one is the dot e MV file that file provides a basic configuration for our app for example
We’ll set up our database connection here and yeah for if we were to use mailing we would also set a set of our mail server here so additionally to our config files here that’s like the quickest way to set up some basic yep connections mainly as you can see anti
Artists and file where that is not important on its own but the are titian file or command is like to come and line unilateral and we access it by writing PHP artisan and then whatever command and we will look into those commands obviously throughout our application we can for example create
New models or database migrations speaking of models migrations views and controllers level is a MVC framework as you might have probably guessed by now and as such we have that strict separation between or yeah between view model and our controller and this is how we will structure our laravel apps
Enough of the talking we got our level 5 few here at the moment and i as i said i want to build an application where we have like a mini social network we have a stream of of posts and we can post or create posts ourself and we will be able
To see all the posts of all our people posting things we can then like and dislike those posts and yeah we will be able to sign up and or sign in if we are already signed up so what are the core features we have well we need some kind
We need a database to store our users to store our posts and to store our likes and dislikes so that’s one thing um we also need some kind of authentication logic because our user should be able to first sign up and then when they were created they should be able to sign in
And we also need to be able to check for certain functions to be available if the user is signed in so that’s something which we will have to take care about this authentication thing and you will see we won’t have to take care about that much because lair or goddess err
Yeah so we have to create our different views for posts for signing up and signing in for creating posts so a lot of stuff were very using models controllers fuels who have routing because we all have different views where we have to route – depending on the user’s reaction we obviously as I
Said have authentication we might throw in maybe let’s see some some mailing that we get sent a mail when we sign up so even though it’s not the comm most complex application out there it already has quite a lot of features you will see in in yeah in day to day applications
Out there now enough of the talking now the video is already quite long what I want to do is first let’s talk a little bit deep were different the various views I mentioned so we get our welcome view here and we will have kind of welcome for you in our final application
To which they’ll basically say whatever we should log in right because we only want to be able to see post if we’re logged in so kind of Facebook if you’re not locked in or not signed up well you’re not to able to do much yeah there are public pages but in our application
We’ll only be able to see something once we’re locked in so we should maybe just added this default view of it so that it is not final version because we will need some styling and that will take a little bit longer but just so that we yeah feel the direction we’re going to
So let me first get rid of all my of all that here or and of the container def or two and here of the styling I won’t need that fund here um what I want to do is and that’s the first thing about lateral views or about the templating engine
More I want to have a skeleton file like a basic layout which I can then reuse in my different pages because my usual login page will will be an html5 document it will require my styling sheet and so on so basically this skeleton here yeah that that’s the same for each
Document more or less right and there might be other parts like for example a header which will be the same for many pages at least and so on so what I want to do here is I will create a basic layout which my different views can then
Extend and pull in the the functionality or the document structure provided in the layout and add additional information or the really core of the future with them so therefore I just copy all that I’ll create a new folder in my views folder which I will call layouts and inside this layouts folder I
Just want to create a master dot plate or PHP and it’s important you have to use the plate to PHP if you want to use the blade templating engine you don’t have to use that you can write normal PHP code but in this course we will use
It because I’m a fan of it I like it I think it’s it’s a really cool way it makes things easier it’s it’s well thought so yeah I like it in this master file here let’s just copy the skeleton I just yeah I just copied
Here right get rid of it in the Welcome view and in my master view here first what I want to do is the title it’s not really part of the master layout but it should be inserted by the individual view right because we will have a different title in the please sign up
Document and a different title in that are all posts document so therefore we kind of have to provide a hook in the skeleton here and we’ll use a blade templating function so to say our expression which is the following at yield and then title here in an equation marks and that’s a typical
Blade templating engine expression they always start with an @ sign so that means hey here comes a blade templating expression then comes the special command thanks you want to use so in this case it’s a yield function which says here should be something something should be
Inserted here hi I’m a place holder so to say and then we have a name for the place holder which is title and in our brief use we’ll be able to access that title through this placeholder name here and actually and insert our content and we’ll do that in a second because we’ll
Obviously also need this in our body here right but because especially in the body we’ll need to insert our actual content what I’ll do is I’ll create a container div which will be wrapped about around our content all the time so that hasn’t to be part of the actual few what will
Be inserted here and then again I use yield and I’ll give that a name of content and obviously those names are purely up to you you could name this sugar-boy if you want it but I think titles a little more more intuitive maybe so here our content will live let me save this
And if okay we go to our welcome whew I will now have to extend this master layout and I will do so by writing extends at extends again a blade templating expression then the path to the file we’re extending from so in this case it’s in the layouts folder so first
I write layouts followed by a dot to kind of access that folder and then I have my master 4 file and I only write master without top light dot PHP so I always leave out that top light dot PHP part so that extends from that file but
I’m not inserting anything now if I’m just writing like that I won’t insert into specific sections of the layout I target a section by using a number expression at section and here I specify which section and now the key I enter a year for example title always has to fit the key
Off the section here defined of the yield function where I want to enter my content so I’m entering my my title section here and I’m closing it with n section and this will tell level or the blade’s templating engine that everything between the opening section and the closing section tax so to say
Will be inserted right here instead of that ad yield title so here we will have cut just welcome now I’m going to copy that and below title I’ll do the same for content and I’ll just write this is the content save this and now I’m inserting this
Into the section content which is in my layout defined here with yield content so if I now reload my view here you’ll see that we get welcome exclamation mark as a title of this page and this is the content as the content and now while that page doesn’t look super awesome
What we did is a very interesting and very foundation of using fuse at least when using the plate template again channel arable which allows X exactly that to define a skeleton and then just use components to create our fuse so we might have another file where we have a
Different content and we could just copy that and throw in the other content in the other file so that’s the real powerful feature of the templating engine and yeah as I said I really like it and it’s it’s enabling us to quickly create and it will also change fuse and
You only have to make changes in one place because you’re not copying code over and over again because don’t repeat yourself very important paradigm ok so that’s quite a long video 30 minutes or something like that 20 five I guess but I think that was very important now
We’re familiar with the structure of Lera well how to use to play templating engine and where to edit files to actually change what is displayed here in our browser it in the next video we’ll get going with our actual application and we’ll start building
That so see you in that video and have a nice day bye
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
Max's free content is more valuable than other instructors paid content…
Thanks for this nice video. But please, how do we install it on live server when we finished it?
Hi, Do you have any courses for Laravel on your site or udemy, I could see that udemy course is no longer accepting enrollments.
Yes sir Thank you for the tutorial coming live from SOUTH AFRICA
Hi what IDE are you using ? Following tutorial step by step
Can i Learn Laravel from this version ? or We need upgrade the tutorial ? , and how big the difference between 5.2 and 7, thanks man , you'r my teacher
make a complete laravel course on udemy
great tutorial, thanks)
can still do this in lara6.*?
Starting laravel!!
Hi Max, you are very great and your tutorials are easy to understand. I tried to find your courses on udemy but couldn't find.
The course is no longer available to purchase on the Udemy platform. Do you plan to make an updated version? Thanks.
Hi! Is it possible to use Laravel and Ionic together?
2k19 I start to learn laravel with your help. And have you get me a point on the help where I can check all this stuffs like .container + tab make div with class. And this stuffs like 24:24 when you delete tab space. Thank you
I am French but I understand perfectly what you say, thank you very much for this wonderful tutorial!
In 8:09 min in the video I am stuck. I cannot get the laravel page to open in my localhost/laravel/public/- (Object not found!, error 404), been stuck here for day's. Works good on my windows computer but not on my Mac. I am using PHP Storm and trying to follow your steps to the letter. I looked in the description for the useful links to help with the set up, cannot find what I need to get this to work. Thank you for your help. Gabe.
Very thoughtfully done video. Thank you very much for the effort.
Laravel saved my life literally. I was wasting so much of it by using no framework. I certainly learned a lot however its a real time waster to reinvent the wheel.
@Academind can you please let me know which editor are you using?
Is this still relevant in 2019?
This needs to be on Udemy, there is a void in good Laravel courses on Udemy. The "best selling" Laravel Udemy course is an unorganized mess of various mumbo jumbo. It's terrible.
But this… this is great, and you should be making money off of this
thanks so much brother i like you