.NET Developer miserably fails at Laravel PHP

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back boys and girls today I'm going to be trying larel the web framework of the PHP community that is their secret sauce that is how they get their Lambos and I won one to so I'm going to be trying out I'm going to see what's up last year near Christmas time I did try spring Boot and quite frankly I thought it was this video is going to go slightly different because previously I knew Java this time I don't know any PHP so I'm going to learn a little bit of PHP first see what the syntax is about and then we're going to dive in into the framework now I don't have any tooling installed so I'm going to be relying on the Jed brains ID and with that don't forget to check out the description like subscribe if you well enjoy the video and don't forget to comment if you have any questions with that let's go ahead and get started so what I'm going to do first is go ahead and download PHP storm and while that's installing let's go ahead and learn PHP in I don't know 30 minutes let's dedicate maybe about that time let me make this full screen and zoom in so you can also read this and hopefully you don't mind light mode okay so this document describes PHP uh 5 plus I don't know what version PHP is on right now maybe um a little bit uh older so PHP latest version 8.26 so maybe we can try that in uh 15 minutes maybe go a little bit l shorter you know so learn PHP in five minutes there we go uh let's see what we can get medium article medium is crap lately you have uh interfaces classes attributes this looks a lot like C uh you get Fields what is this even this is not considered a comment anymore named arguments yeah okay I guess these are new features so I guess I'm not so much after new features that are coming in phpa I guess I'm after after the core that has been there for you know for God knows how long so anyway uh code starts in with this thing and ends with this thing it's a script that you place over here anything outside tags is echoed automatically we get a print function we get an echo function okay PHP starts as a template engine so actually the things that I do know about PHP is about as much as you put things into these tags and that's because I learned a little bit of PHP a long long time ago that was around the time where angular 1 was popular or was just coming out I can't remember but I was trying to learn web develop and I was like all right PHP angular next thing next thing not actually really building anything not really actually learning anything so none of it actually stuck so dollar sign bullan I don't know if this is a type or this is a variable name looks like variable names okay sensitivity on true and false doesn't matter we get the numbers okay so basically variables start with a dollar sign and then if I want to do a memory deallocation or I guess I I don't know basically delete a variable I do unset uh very interesting so I got some basic arithmetic operations increments okay uh operation con catenated with the assignment you get single quote strings double quote strings I don't know if they can span multiple lines actually just missed this but you can have string interpolation cool so Define some constants I go for okay so I can Define based on Dynamic input array uh so this is a hash map so it looks like this instead of a colon or something like that it's just an arrow so we can basically create a dictionary for some reason you just have functions floating about in the well General name space I guess so you just invoke them to work with these different things but okay if you want to an array you just prefix Square braces next to a variable hopefully I'll remember all this I'll leave this open in case I need to refer to this some like this I don't understand what that is we got the standard comparison stuff strings are coerced into integers so plus is uh only integer operation so how can you concatenate okay concatenation is a DOT and looks like I have scrolled past this okay uh a little bit a little bit weird I guess I want to see how you do object uh property navigation over here then if it's not a do switch case nobody uses that uh while Loops do loops for each Loops everything looks super simple to regular ones regular ones is in regular languages okay you then have for each Loop where you have uh for each wheels and has Wheel count is this an alias okay so I think it's yeah okay collection and then the element on the right so a little bit backwards to how I usually have it then we have a function so the function definition this is basically JavaScript marks the same parameters a default parameter set you can have Anonymous functions all right so I guess these are going to be lambdas I well we'll see how we can basically pass those around but uh yeah let's try to get to maybe a class okay so we have a class the class has some functions did it have properties okay so you have access modifiers you have static uh members uh let's see how you access those so uh my const what was my const my const was a no okay so just a const and then static and double colon is how I access stuff on the class and my static method if I want to create I create a new class this way and the arrow I think this sort of syntax is used in C++ so I think that is about all I need to know here the syntax doesn't really look that foreign there are some things I guess well from reading this at the first glance and really not having any muscle memory I'm I'm going to be like what do I write here probably going to take me a minute or two but in end of itself I basically I know how to define a class I know how to define a function and invoking functions looks the same and if I want to access a property I even have a null call Lessing or nullability check before I try to access something so uh this actually looks pretty cool pretty cool right it's basically C or like any other of those programming l languages that have all those modern features right nothing too new all of the programming languages these days are basically the same they're all like aggregating or like going into the same Singularity and it's going to be mostly I think about the runtime PHP storm is downloaded let's go ahead and get that everything's spawning on a different screen so uh do not import settings that is going to be okay hopefully what I'm praying on is PHP storm is going to hold my hand and is basically going to go like you don't have PHP installed how about you install PHP and I'm going to be like oh man thank you very much and we will call this larel app okay uh let's go ahead and create so PHP empty project has been created we get a cool little screen and let's Zoom this in if the zooming in works and it doesn't so what you do is you search for zoom zoom in ID is this crazy keybind over there Control Alt tub okay there we go so maybe that could be a little bit too much we have an AI assistant really don't give a about an AI assistant right now uh we want a new larel application please and maybe go back to project files so I mean the directory is really empty there is nothing there and uh well I wanted to get rid of um this uh bar on the top so I think it's Zen mode so enter Zen mode there we have it so really don't have anything here anymore uh okay my what you call it my keybinds are messed up as well so open and terminal I just want to make sure that I have access to a terminal let's clear this and while that is happening let's go ahead and Google for larel LEL okay I obviously can't spell as well so uh that's that but right code for the joy of it so uh this looks awfully like as. net core minimal apis maybe that's where net has got it from so maybe this is going to actually be a walk in the park uh route get profile profile controll class and from here middleware off not sure exactly how this this might be a carrying function over here that basically oh no actually so this is going cuz this is going to probably return to type and we're invoking the middleware method on it and supplying a key off okay uh okay I'm not going to get into the weeds too much I just want to actually go ahead and get well get started so uh let's make this a little bit bigger creating a larel project here we have composer create um project larel so PHP and composer if you're developing on Mac OS PHP and composer can be installed via larel her in addition we recommend installing node and npm okay uh this bit I have done larel her whatever this is download for Mac okay so this bit I don't like one bit let's go ahead and come back over here so uh let's try create a new project let me try again and see if I've missed anything over here so PHP storm Workshop project composer package project uh I guess uh that's kind of it command line parameter nope all of it looks trash composer uh that is all rubbish as well now let's check out what composer is dep dependency management for PHP so let's get started we got to get the composer executable so let's download this file okay gu sign me up let's go ahead and download this file so what I actually download I downloaded the installer and installer is a PHP script so I don't have actually PHP installed and the writer didn't really hold my hand so let's go ahead PHP install PHP uh installation configuration General installation installation on Mac OS holy camole uh looks like I'm going to have to use Brew so let's come back over here okay so that took a little bit to way too long because I haven't touched Brew in quite a while so it decided to upgrade everything okay hopefully I get PHP command now uh is this an interpreter uh maybe Echo hello hello hello okay uh nothing happened over here maybe PHP help uh some commands over here and maybe actually let's try it again PHP uh what I need uh PHP Echo hello uh s me colon and like this was it let me quick come back to the script over here because I forgot everything that I just read cuz it's been like two seconds and no actually uh I am correct so uh what the hell so hello world automatic okay so this is not a repple maybe it is but I'm probably using it incorrectly uh I have some idea stuff over here let's create a new file um hello uh PHP and I'm going just going to try to execute it right so uh okay boom uh how do I can I close it off uh can you help me close it off no okay so Echo uh hello world okay semicolon okay maybe got to make sure I wrap it in a string okay all the key binds are messed up there a complaining about new line over here okay right uh don't care about that uh let's try hello.php and we get hello World okay uh I can execute scripts I am happy with that anyway I installed PHP because I wanted the composer tool and the composer tool I think actually relied on PHP okay so we got PHP installed uh that is done now we have to get about uh what's called setting up composer on Linux Mac OS so download the composer executable so I downloaded this file so from reading this the compo this thing that I downloaded is an installer and what I have over here is basically I want to install it locally and not globally so let's come back over here we're going to move the installer file that I have over here into over here installer should have the installer here now and then PHP installer let's go ahead and try to run it and now that I have whatever this is the composer far you're working directory PHP archive I have to run this command and in order to run the composer tool so composer par and there we have it okay I don't I don't know exactly how the heck uh that works uh but there we have it so I have a local thing hopefully I can get rid of the installer because that's what I'm going to do and I have this composer tool let's go ahead and use composer to create a project and larel LEL example app so uh let me paste the command over here instead of composer I'm just going to go ahead and grab the previous command and example Ure I'm going to go ahead and do that okay so I should have the example up over here cool uh that is very annoying that uh I'm not sharing my key binds so anyway we have an example application and holy camoly is it big so let's go ahead and try to figure some of this stuff out out uh we have a read me file okay uh let's go ahead and preview the whole thing so we got some you know just typical read me file doesn't tell me how to run the application just uh where to go and stuff like that so we don't need that and I think one thing I noticed here so the editor Windows aren't appearing so quickly Windows uh active tool window or sorry editor tabs configure editor tabs just so they're actually shown so just like that okay I actually like seeing what file I'm in uh okay so the screen is ungodly big I have this weird indentation that um jetbrains IDs love to have sometimes so Artisan PHP file whatever so again my okay it's actually using end for environment variables that is actually very nice so it's reusing some kind of well basically the same technology ology is used elsewhere so it's nice to see it being reused rather than some proprietary thing like app settings that we have in the net world we have composer Json so this would be package management same as package.json with the lock file okay and we actually still have package.json and we have axus uh larel vit plugin so we're using Vite over here I'm not sure what it's being used for and then we have PHP XML which I guess is kind of like uh the Cs project file where it's just the project definition because I'm seeing uh folder configuration here so it's saying that's a test that's a test and uh app is the actual application directory so bootstrap let's quickly have a look at that uh this looks Mighty scary so I'm going to go ahead and hide that configuration um again this looks looks actually pretty scary so I'm not going to look into that database factories use Factory this again looks very very scary so I'm not going to look at that we have console exception HTTP uh this is meant to be the actual app and so far uh basically I don't know where the entry point to my application is so I am slightly confused where in net I would just have the program CS file and you know I'd I'd be ready to start so anyway uh PHP Artisan serf so actually from that command I might just retract U my what's it called the my opinion artison must be the entry point so let's go ahead and have a quick read through this so actually I'm probably going to be end up clicking on uh this tool Windows bar to get my terminal back up because I don't have my keybinds okay what I don't understand any of this whatever Artisan does it basically I'm noticing that it is Artis un serve so if I'm going to take a look at composer Jason I'm going to maybe expect to see a serve somewhere in here uh serve no uh package.json serve no um serve in here uh let's um see serve I'm I'm expecting to see some kind of script definition maybe it's just just an argument that I'm providing to the internal tooling so if I don't see some kind of well basically key value key serve on the right hand side this is what we're executing so I don't see anything like that so I'm going to assume that it's just some internal tooling that is going to start executing the server okay anyway uh let's go ahead and run this and there we have it so if I guess this is all just a landing page which I guess is pretty cool nice I guess that I could just get started like that but it has it has too much it has too much details I basically I don't understand any of it I I want something smaller so what I'm going to look for is larel minimal template okay okay I'm not going to be delving too F but that article basically says what I got is already an empty project so a bunch of tests I don't really care about tests so I'll just leave it there storage um okay framework compile PHP I don't know what all this is a bunch of get ignores okay it's worrying that these things are empty all right here we have the API and I guess slash user channels mods user ID console I don't know what these things are maybe this is something that I can work with I have a view of welcome over here uh let's double check the API though cuz it has this slash off user so I'm going to come back to my application let's duplicate this tab SL user and not found maybe this has to be prefixed with API I'm not sure okay and it does I guess route login not defined so I'm guessing on the left is a stack trace this whole thing is a stack trace and then this is basically telling me which code has actually broken so in HTP middleware authenticate and Route not found exception so I don't have a a login okay uh let's go over here and uh just I don't know try output login I'm going to I don't know hello world H maybe something like that probably worth trying that over here actually uh let's come back over here refresh and we get Hello World okay so uh just like net I can return a string I don't know where this view is coming from by the way so might be worth actually exploring this uh and probably the best way to do this if I refresh this I will um uh try to grab maybe about y much of this text and search for it here so welcome blade PHP where is this located and resources so these are views okay and looks like that search that I recently did for blade this is using that templating actually if route has login looks like it's going to display some stuff so do I I I mean I did uh bring up login um didn't bring up this bar let's see if I needed to create a completely new file for this so login uh PHP uh let's go ahead place this over here nothing works uh CU it it needs ah so it's not actually using the closing tab the pH the PHP script never ends okay uh let's put this over here uh where is my terminal let's take a look at this nothing is happening over here let's refresh and the route still hasn't appeared let me just double check this welcome blade PHP is indeed the thing that I'm looking for so I'm just going to put hello world over here and I'm going to expect hello world to appear okay so that is cool so route has login I want to see what that does right so right click uh let's see if there's some kind of decompilation or something like that so let's see go to implementation right take me there and nothing happened so what was the key bind again go to command B declaration or usages okay I guess I don't get any decompilation I can take a look at the route I guess well the tooling is basically not as good as as it would be for a CP writer where I can just open up the hood and take a look at the source code I understand larel is probably open source and I can search for that source code but again I'm just kind of here exploring I don't want to go too far so anyway right route has login I am expecting this to somehow detect if I have a login route and we do something with it right okay so this article didn't answer any of my questions but I stumbled upon this which says you can put a name on your route so I'm assuming now that I just need a name on my route so over here uh let's set the name to test this should uh where's my welcome blade test test and if I come back over here obviously the thing isn't running because oh it's not running I didn't I didn't turn it on uh let's come back over here and the button is still not there uh let me regenerate this route cache whatever it was and serve again so's refresh this okay and now we see it uh so the route cache generation is super annoying I don't understand why I actually need to run it but that is okay so if I again my terminal is out of control here because the screen is very big if I go over here and I name this uh login uh come back over here the nothing is happening to the application okay uh let's just uh open up a second the uh terminal over here where is this open Terminal I'll bring up the previous commands so I'm going to hopefully expect this to run while well while it's serving I can re restart the route cache again a little bit annoying that I have to do it manually but look the login button is there okay so I figured out how to add routes uh now if I can add new routes I actually want to place some logic over there so let's do something simple over here on the login route uh let's call out print I think it was and another another hello world you can see I love my hello worlds and the location over here let's see if that has um actually hot reloaded it didn't look like it did let's go ahead and uh refresh this and the whole thing just exploded let's go ahead serve it again so printed hello world it didn't print anything to the console but it actually just printed it out into some kind of void or like the thing that it return okay so I'm going to remove that and yeah so no hot reload I mean we don't really get that we get a file Watcher if I regenerate this looks like it works sometimes cool uh let's create some Global state I'm going to start off with uh just having some numbers this is going to be an array and let's say empty array to start with um I'm going to remove this login page because I don't care about it uh let's get the numbers uh this is going to be a route name let's um actually let's do this I'm not going to put it here uh let's actually take all of this stuff take it to the API we're going to remove uh this part over here because I feel like well it's some numbers Behavior right and by the way this numbers I don't know how to do Global state in larell I'm just expecting look there's a file uh before I Define this function there's going to be this thing it's it exists outside of this does this run every single time at which point will this state actually well be reset right so uh numbers let's go ahead and just flat out return the numbers looks like that isn't working undefined variable let's quickly come back to here and uh see if there is anything clo like closure in here we'll see PHP closure let's see how that works uh this looks awfully complicated or never mind you got to say use directory so you have to be explicit about the closure that you're using I guess and number okay there we go actually kind of like it I I'm I probably like it because it is well uh what' you say it number uh let's say just num I I like it because it looks new and I just get a little you know like oh I just learned something new uh this must be good I want to push add add to oh my God I'm going to have to refer to the manual over here uh let's come back all the way over here add add element to an associative array add an element to the end of an array interesting or array push okay I get an array push somewhere over here uh let's say array uh push we will have the number array and I will apply the number over here semicolon uh let's say just added over here okay uh what do we have over here replace with this okay so I don't really like this I like the previous option I don't know if it's some kind of convention do let me know in the comments is this the what's it called the de facto way to add things to an array this looks a little bit weird to me okay uh but anyway we got our post let's just make sure that we are well capable of off sanctum this is okay so that is invoking the middleware first and then get so whatever authentication middle Middle where that runs before we do the get so actually I don't want this bit over here I don't want the authentication because I'm just interacting with a global state so uh let's have a look at this we are going to have API numbers uh it is empty so what I'm going to do is well regenerate my route cache or whatever it was and there we have it so an array of uh arrays I have probably defined my array incorrectly and I did I just want to basically say that it's just an array okay so the type is implicit and I guess now I want to do array push over here and not this weird syntax that got suggested to me because I was probably doing something weird Okay so again it's suggesting something number array okay uh I'm going to well I'm just I'm going to leave it like that unless the uh mutation is uh unless it's actually actually IM mutable uh which we're going to see in just a second so numbers I will need to regenerate this let's go ahead and refresh that and cool so actually I'm going to change this to get because I don't have an HTTP client here real but I just want to be able to do this through the route so numbers uh doesn't work uh so we're just going to do add numbers okay uh forgetting to regenerate this okay no number collisions let's go ahead and duplicate this time we're going to do add numbers and num and let's do five okay so I'm surprised that you can't just model bind it you got to do well either get it for the request or whatever this input thing is so uh let's go ahead and try it both ways instead of this uh let's give this a request request grab the request over here uh of course not not a DOT we want to uh query key and number okay I will need to regenerate come back over here and let's run this okay so it allegedly has been added and nothing has actually happened so let's take a look at this yeah so it looks like an add sign so I'm surprised that that is a thing okay I thought it would be passed by reference by default but it isn't so num 10 still not adding it added uh do I have to pass it over here by reference as well no what and that is exactly what I'm doing so I'm having a little bit of conundrum here let's put some original values into there and just make sure that the thing is actually being serialized correctly and this cache restarting is you know pretty annoying this one so refresh still doesn't add anything to it uh let's say yeah I'll just want to add a number five over here obviously have to regenerate the routes uh but the five does get added there so basically what what I suspect is happening is the whole thing maybe somehow gets reran or something like that and I get a fresh um numbers array every single time uh let's go ahead and actually try to return numbers array here see if uh well it actually changes in anyway I think that will be massively helpful to see okay so I am mutating it it's just not being mutated over here and it looks like I am passing a reference so I'm just I just don't know how to do Glo Global state in larel so let's go ahead and try that so larel uh tier locations laral laravel global State here we go right at the bottom dependency injection and controllers are injecting this and then on this we'll be able to find this okay perfect perfect I like this uh zero configuration resolution I am going to create some kind of service and I can inject it okay okay now we're talking now we're talking maybe that's where I went wrong right uh class State uh let's go ahead put this in here uh maybe this needs to be private and uh this needs to be private uh actually this is an instruction don't want this here I want this public we are real programmers that are using real programming paradigms so number uh State oh I misspelled State there so what's happening over here number okay uh okay because I had a dollar sign over there and that doesn't need it anymore so over here because this is public let's create a public function add number this is going to be number just for practice know purely for practice uh this I get a this because oh this wait I put a dash and it puts the arrow just for me okay it's just like a what's it called writing a DOT okay so num semicolon and there we have do I have a formatting button nope I don't want to type that and now we're definitely cooking uh so State uh let me State come on ADD no okay okay okay and then we pass the num over here I I feel like this is this is about to be a break through re regenerate caches get the numbers and state doesn't exist obviously because cuz why not why would this work cuz it told me this would work and it doesn't work okay so this example play it places it in web.php and uh this is gamechanging game if it work all right uh let's try do that web.php place it over here I'm going to take my API routes over here I'm going to place them into web.php and regenerate routes okay so now instead of apis I'm going to have to go to numbers and whoopy do it doesn't work again I'm going to give the benefit of the doubt and restart the application and service still doesn't work maybe I have misspelled class so class service and class State service I am placing it in a function on Route get that is exactly what I'm doing mainly app service provider is used so this thing over here we have a register function apparently it looks like I haven't placed a name space over here so Nam space app uh let's put State over here okay semicolon uh let's regenerate and actually in web this is oh my God wrong keep mind again wait for the dot import class cool uh hopeful maybe if God willing oh my God it still doesn't update it this is horrible unless I royally messed it up I'm calling ad number it doesn't change the state unless uh the way that the state is being created is new every single time cuz I haven't created a Singleton effectively uh let me see okay and it looks like this bit over here and this use State service is actually maybe mood point now the magic somehow suddenly works it does okay so let's uh of all the thing single binding a Singleton you can use the Singleton method okay okay so instead of bind we use Singleton we do the Imports over here do the refresh I no longer know what I'm refreshing and uh I made a class with a static field which I'm mutating which I can see it's being changed over here but then once I'm in this function over here it changed back okay so I think after maybe like an hour of research reading I've managed to find out that PHP does something to reset all of the static properties so I don't think it has like a runtime it is basically initialized and destroyed per request so that is why I am not seeing my static variables being updated between requests a big s a big surprise to me uh also a lot of articles about developers in the PHP Community just being like you shouldn't be using static anyway shut I want some State and I believe that should just well while my application is running it should be there but if it's just something that spins up and down clearly I don't know what PHP is at that point or whatever it is that I'm where is this thing whatever it is that I'm serving over here isn't actual an actual application it's just something that is going to initialize this PHP script to me this sounds bizarre basically if I want some kind of storage I'm actually going to have to go to a database or you know deal out cookies do whatever I need to do to get uh between request storage so I think that's going to be the next step let's connect to a database okay database LEL pogress password is password DB connection pgsql I think it was over here pgsql yep 543 okay so it's overwriting over here post address and password is password does look like I might have to write the my migrations myself let's take a look at this database migrations so there are a couple here already let's take a look at one okay I'm going to go really simple let's copy this across and uh 23 uh whatever doesn't really matter well create Tod do ID we will call this title email doesn't matter verified doesn't matter remember token doesn't matter let's say table ban complete okay semicolon on the end missed a couple of letters let's go ahead and run the migrations so PHP Aron migrate uh that's because I'm not inside my example application and there we have it looks like all of them are done so let's see what we got here so we got the to-dos it looks like it's great everything so pretty easy migration process uh one maybe good maybe bad it is a dynamic language with some type hints but you're basically writing migrations yourself these are not generated automatically based on your schema how Entity framework does it in net and actually in Spring boot the whole schema gets generated for you but inet we also have tools like that for example Martin will create the database it will create the tables for you if they don't exist uh you can just boot up your application start using types and the database will just create itself as a you're using those tables so anyway we managed to finally well get our database let's go ahead and start interacting with it so in the getting started page you don't get a crazy good orm you get something like this I think unless uh there is something like that so eloquent orm over here uh let's check this out so object relational mapper right and actually it looks like the the eloquent Orum is going to give me what I want so Let's uh try to follow this I'm going to go to the terminal and let's run this oh you know might have spoken too soon uh we'll just call this to do O Okay so double O in my app models I have to do it has use Factory whatever that is uh but let's try to use it like a regular property or how we did it so there was an ID uh I want a a title and I want complete it I don't know about that let's just give all of this uh public modifiers and hope it just works okay so it looks like there was actually a step generated with migration so let's try this again I'm going to take all these delete delete the to-do and we're going to remake the model with the to-do and the migration I don't know what that's going to do exactly let's go ahead place it over here create to-dos and IDE and Tim stamp okay so I created my to-do model I added these things in here but they didn't automatically map onto the migration so even though I use the command line to generate the migration I still had to add this into here okay so so far my experience with lwell I would call it not too good so uh let's go to the too over here and the too over here uh that we're going to call this ad and let's actually take these routes and do it properly let's go to the API side so API wrong button api.php over here and uh first of all we're going to need to add some to do so let's actually get rid of this uh request uh I might actually Supply a title over here uh let's remove this and we are going to have the to do I think we can do created okay I'm going to ignore the Intel since I'm going to assume that it's just going to work so title we are going to supply a dummy for now I'm obviously not doing it correctly that is a Java arrow and uh completed uh we're going to assume that well maybe we'll assign a all maybe it won't assign a all uh so we do the automatic import let's say that okay we have returned something and and on here uh let's uh well let's put a query uh how do you query over here this page is so big it's annoying to scroll so collections we just do where get and rather there should be a method that just says all just like that perfect coming back over here API too it is obviously not found I don't know why this is happening to me somebody can explain this have to regenerate my routes and when I do uh the relation to Dos does not exist are you kidding me what does exist we have two dos right over there if I go ahead take this query uh let me copy it uh place it over here semicolon on the end and two this doesn't exist you are correct still doesn't exist hold up so what does exist uh to do tables what well how did that happen to do table what okay okay um that's a bunch of I don't know how the that happened okay okay let's take okay I think we have a you know a breakthrough so migrations write them yourselves the the tooling is there but you know you got to learn it and uh uh whatever I'm probably just appreciate this API PHP let's try to add something add the title with this title okay uh maybe it's a little bit simpler than that I'll just do to Doom here we have our to doom and the dollar sign obviously to do we are going to have a title and we're going to set it to num okay uh this num is a little bit uh misleading it is a title let's actually name it correctly and on the to-do there is maybe a create or save okay uh let's refresh the route give this a refresh refesh everything uh and nothing is being added okay so I manage to save some things in the database and I'll be honest I do not like it one bit uh here is the experience so on the surface get all you if you want to actually create something you first create the entity and your are doing the saving through the entity model okay if you want to set some kind of properties you got to set it on the properties which you're not allowed to put on your model so if you put something like this on your model your code starts breaking and it's not actually setting the things that you wanted to set in the database uh the migration models that you're generating you have to write these out manually uh can be good can be bad depending on how you look at it I don't like it I think I should be able to put properties in my model generate um and uh rescan my migrations basically the one the way that Entity framework does it is really good compared to this this is H Sapar as I would say I'm actually going to draw the line here and stop the video I was really looking forward to enjoying larl but uh I'll be honest it has actually disappointed me I thought the PHP Community raved about it it is so good but I don't think it is better than asp.net core let's start from the beginning of basically trying larvel and what I think is bad and good about it and hopefully you can forgive me for being a little bit tired at this point but uh first of all the massive project that you get that is apparently the beginner template or the empty template uh that's not an empty template you get a bunch of configuration for various things tons of you get like pre-baked uh all of the pre-baked like pgsql MySQL mssql just all of these configuration files ready for you to swap in values sure that may be useful for some but in terms of starting off and just being bombarded with all of this information uh not a good experience I would rather have uh just one main file and then opting in feature by feature as I'm learning about it as I was kind of getting a hang of it there's the routes API and the web files which will allow you to Define uh the files for your web application and then for the API which is going to effectively be called via Ajax I think that's good uh I think that was relatively simple in terms of running the application and then having to update the route and then to regenerate some kind of cache I thought I didn't have to do it at the beginning but then I think I did it once and then uh it just stuck so for the rest of my experience the application was running and as I was updating stuff I just had to regenerate some cash so that was extremely draining from the whole experience I don't know how I could turn that off and then the whole dependency injection story as I was trying to get some persistent State between requests as I found out it just wipes your static State I don't know what that is about but I feel like that just destroys the purpose of the whole Singleton scoped and transient lifetimes of your services as they have in PHP so you're going to be forced into using something called session storage or you know just a database Redd is post gql as you've seen I tried post gql then connecting to the database the eloquent omm you're basically going to use again this Artisan tool I I don't know why it it reminds me of the um what's it called the the angular tool for generating components but when you have your components are massive which are consisting of like five files and and you're like I got to create five files every single time I want a new component of course you need a tool for it if uh your framework is not convoluted and you like okay I just want this thing that thing but if you need to keep track of like a thous a thousand things that you might want to potentially create uh the same as you have with Artisan over here so if you want to create a model if you want to generate a controller for it a factory method a migration and the migration is then you know it doesn't actually keep track of anything that is on your actual model like Properties or stuff like that I placed properties on my model I generated the migration and I thought like oh I'm going to get the migration with all the properties no I still had to uh go and uh put all of those things inside the migration manually and then on top of that it actually generated the incorrect table for me so yeah in terms of managing your models and managing the data base it's going to be a little bit more of a manual experience type of thing but then the quering and the insertion it's not too bad the quering I think is pretty good you just do your model name and then you start querying right like that you don't get an extra DB context which is kind of saying okay uh here's the model and you're going to use the model to query it or rather the model even though that it extends a class called Model it is not an actual model it is more of like the thing that is going to do the querying for you and then it's going to because it's a dynamic language you're is going to have to know which columns are in your database you're not allowed to put those properties on your model otherwise stuff starts breaking when you're trying to insert entities again all of this maybe I'm using it incorrectly uh larvel framework whatever the PHP Community says about it if you're a net user and you're watching this summer if you manage to sit through this stick with net aarl is not better you're not going to enjoy it everything in net is a lot easier and that is my personal opinion I really thought I was going to enjoy larel I don't mind the PHP language just different symbols in different places in terms of the framework itself I did not have a good experience and uh yeah but hopefully you had a good experience watching me suffer so if you did enjoy the video leave a like subscribe if you have any questions make sure to leave them in the comment section a big and very special thank you to all of my Patron supporters you helped me make these videos as always thank you for watching and have a good day
Info
Channel: Raw Coding
Views: 12,980
Rating: undefined out of 5
Keywords: .net, laravel
Id: v_W4Kb9DPes
Channel Id: undefined
Length: 52min 23sec (3143 seconds)
Published: Wed Dec 20 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.