title
Laravel From Scratch [Part 6] - Fetching Data With Eloquent

description
In this video I will show you how to start working with Eloquent which is an ORM (Object Relational Mapper) and it makes working with the database models VERY easy CODE: Complete Code For This Series https://github.com/bradtraversy/lsapp 10 PROJECT LARAVEL COURSE: Please use affiliate link below https://www.eduonix.com/affiliates/id/16-10485 50% OFF: Use special code "traversy" SUPPORT: We spend massive amounts of time creating these free videos, please donate to show your support: http://www.paypal.me/traversymedia http://www.patreon.com/traversymedia FOLLOW TRAVERSY MEDIA: http://www.facebook.com/traversymedia http://www.twitter.com/traversymedia http://www.linkedin.com/in/bradtraversy

detail
{'title': 'Laravel From Scratch [Part 6] - Fetching Data With Eloquent', 'heatmap': [{'end': 292.907, 'start': 258.527, 'weight': 0.74}, {'end': 351.132, 'start': 333.052, 'weight': 0.884}, {'end': 424.786, 'start': 409.438, 'weight': 0.746}, {'end': 515.299, 'start': 497.98, 'weight': 0.996}, {'end': 1135.612, 'start': 1097.924, 'weight': 0.707}], 'summary': "Tutorial covers creating a post controller with resource functions, implementing looping in laravel, and using eloquent for fetching data, including ordering, retrieval, sql queries, limiting posts, and pagination, highlighting the simplicity and benefits of laravel's eloquent.", 'chapters': [{'end': 146.047, 'segs': [{'end': 48.189, 'src': 'embed', 'start': 0.836, 'weight': 0, 'content': [{'end': 1.677, 'text': 'Hey guys, welcome back.', 'start': 0.836, 'duration': 0.841}, {'end': 3.979, 'text': 'In the last video, we did a few things.', 'start': 1.857, 'duration': 2.122}, {'end': 10.524, 'text': 'We created a post controller and we added some resource functions here, index, create, store, etc.', 'start': 4.019, 'duration': 6.505}, {'end': 13.506, 'text': 'We also created a route.', 'start': 11.365, 'duration': 2.141}, {'end': 19.571, 'text': 'If we go to our routes web.php file, we created a resource route for our posts.', 'start': 13.726, 'duration': 5.845}, {'end': 23.354, 'text': "So that's going to automatically map routes to those functions.", 'start': 20.152, 'duration': 3.202}, {'end': 25.236, 'text': 'And we also created a model.', 'start': 23.935, 'duration': 1.301}, {'end': 30.04, 'text': "If we go to post.php, that's our model, which currently doesn't have anything in it.", 'start': 25.636, 'duration': 4.404}, {'end': 31.801, 'text': 'now your model.', 'start': 30.68, 'duration': 1.121}, {'end': 37.284, 'text': "really you don't really have to do much here because everything is in this okay, all the.", 'start': 31.801, 'duration': 5.483}, {'end': 44.187, 'text': 'uh, you know when we do something like post, the post model, and then we do all okay to get all posts.', 'start': 37.284, 'duration': 6.903}, {'end': 48.189, 'text': 'so this is this is coming from the the model that this extends.', 'start': 44.187, 'duration': 4.002}], 'summary': 'Created post controller, added resource functions, and established a resource route for posts.', 'duration': 47.353, 'max_score': 0.836, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4836.jpg'}], 'start': 0.836, 'title': 'Creating post controller and model', 'summary': 'Covers creating a post controller with resource functions like index, create, store, and a resource route in web.php, along with creating a model and explaining the functionality and customization options available in the model file post.php.', 'chapters': [{'end': 146.047, 'start': 0.836, 'title': 'Creating post controller and model', 'summary': 'Covers creating a post controller with resource functions like index, create, store, and a resource route in web.php, along with creating a model and explaining the functionality and customization options available in the model file post.php.', 'duration': 145.211, 'highlights': ['Explaining the resource functions in the post controller and the resource route in web.php The video covers creating a post controller with resource functions like index, create, store, and a resource route in web.php, providing a structured approach to handling posts and routing.', 'Demonstrating the functionality and customization options available in the model file post.php The model file post.php is explained in detail, covering the functionality and customization options available, including table name, primary key field, and timestamps for records.']}], 'duration': 145.211, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4836.jpg', 'highlights': ['The video covers creating a post controller with resource functions like index, create, store, and a resource route in web.php, providing a structured approach to handling posts and routing.', 'The model file post.php is explained in detail, covering the functionality and customization options available, including table name, primary key field, and timestamps for records.']}, {'end': 629.879, 'segs': [{'end': 292.907, 'src': 'heatmap', 'start': 258.527, 'weight': 0.74, 'content': [{'end': 266.197, 'text': "All right, so if we save that and now we go to slash posts, you'll see it's loading that template, that view.", 'start': 258.527, 'duration': 7.67}, {'end': 273.953, 'text': "So back in Post Controller, we want to fetch our post so we're going to bring in the model.", 'start': 267.688, 'duration': 6.265}, {'end': 286.383, 'text': 'Now the model has the namespace of app and then it has the title of post so all we have to do to bring it in is say use app backslash post.', 'start': 274.754, 'duration': 11.629}, {'end': 292.907, 'text': 'And then we can simply say post, and we can use any of the model functions.', 'start': 287.503, 'duration': 5.404}], 'summary': 'Fetching and utilizing post model functions in post controller for template loading.', 'duration': 34.38, 'max_score': 258.527, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4258527.jpg'}, {'end': 331.731, 'src': 'embed', 'start': 303.834, 'weight': 1, 'content': [{'end': 307.157, 'text': "But we can do regular SQL, and I'll show you how to do that in a second.", 'start': 303.834, 'duration': 3.323}, {'end': 310.599, 'text': "So let's put a double colon and then all.", 'start': 307.817, 'duration': 2.782}, {'end': 316.583, 'text': "And that's part of Eloquent that's going to fetch all of the data in this model, in this table.", 'start': 311.439, 'duration': 5.144}, {'end': 324.047, 'text': "So if we just test this out and return this, it's going to return this and stop.", 'start': 317.443, 'duration': 6.604}, {'end': 325.128, 'text': "It's not going to load the view.", 'start': 324.087, 'duration': 1.041}, {'end': 329.95, 'text': "You'll see that it actually gets all of our posts.", 'start': 327.769, 'duration': 2.181}, {'end': 331.731, 'text': "It's in an array.", 'start': 330.771, 'duration': 0.96}], 'summary': "Demonstrating the use of regular sql in eloquent to fetch all data from a model's table, returning posts in an array.", 'duration': 27.897, 'max_score': 303.834, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4303834.jpg'}, {'end': 365.266, 'src': 'heatmap', 'start': 333.052, 'weight': 0.884, 'content': [{'end': 341.137, 'text': "So let's go back and instead of returning it, we'll put it into a variable and then we'll pass it into our view with width.", 'start': 333.052, 'duration': 8.085}, {'end': 351.132, 'text': "All right, and then in our view, in the index, we're going to loop through it.", 'start': 347.688, 'duration': 3.444}, {'end': 353.033, 'text': "So let's first check for posts.", 'start': 351.252, 'duration': 1.781}, {'end': 365.266, 'text': "We'll say if count posts is greater than one, and I'm going to put an else and then an end if.", 'start': 353.934, 'duration': 11.332}], 'summary': 'Code snippet to pass variable into view for looping through posts.', 'duration': 32.214, 'max_score': 333.052, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4333052.jpg'}, {'end': 424.786, 'src': 'heatmap', 'start': 365.526, 'weight': 3, 'content': [{'end': 371.572, 'text': "So the else, we'll just put some paragraphs, and we'll say no posts found.", 'start': 365.526, 'duration': 6.046}, {'end': 378.85, 'text': "If there are posts, then we want to loop through them, so we'll do foreach.", 'start': 375.527, 'duration': 3.323}, {'end': 384.394, 'text': 'And we should be able to do posts as post.', 'start': 380.431, 'duration': 3.963}, {'end': 391.7, 'text': "And then here, let's put a div with the class of well.", 'start': 388.837, 'duration': 2.863}, {'end': 393.501, 'text': "We're using bootstrap.", 'start': 391.78, 'duration': 1.721}, {'end': 409.438, 'text': "And in here let's put an h3, and we'll just do double curly brace post title.", 'start': 399.586, 'duration': 9.852}, {'end': 412.8, 'text': "all right, let's try that out.", 'start': 409.438, 'duration': 3.362}, {'end': 413.38, 'text': 'and there we go.', 'start': 412.8, 'duration': 0.58}, {'end': 424.786, 'text': "so we're looping through the post in our database and then let's just put a small tag underneath it and let's just say written on,", 'start': 413.38, 'duration': 11.406}], 'summary': 'Using a foreach loop to display posts with post title and written date.', 'duration': 47.274, 'max_score': 365.526, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4365526.jpg'}, {'end': 524.283, 'src': 'heatmap', 'start': 497.98, 'weight': 0.996, 'content': [{'end': 504.185, 'text': 'slash and then the id, which we can easily get with post id.', 'start': 497.98, 'duration': 6.205}, {'end': 507.158, 'text': 'all right.', 'start': 506.758, 'duration': 0.4}, {'end': 511.319, 'text': "so let's save that and then it should take us to a blank page.", 'start': 507.158, 'duration': 4.161}, {'end': 515.299, 'text': "because it's just, it's loading the show function but there's nothing there.", 'start': 511.319, 'duration': 3.98}, {'end': 520.642, 'text': "so let's go to our controller and go down to show and notice that it's passed in the id.", 'start': 515.299, 'duration': 5.343}, {'end': 524.283, 'text': "it's. it's going to get the id from this url.", 'start': 520.642, 'duration': 3.641}], 'summary': 'The controller is receiving the id from the url and loading the show function.', 'duration': 26.303, 'max_score': 497.98, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4497980.jpg'}, {'end': 629.879, 'src': 'embed', 'start': 552.29, 'weight': 0, 'content': [{'end': 558.071, 'text': "so eloquent is very, very simple, it's very handy and it's very clean.", 'start': 552.29, 'duration': 5.781}, {'end': 563.983, 'text': "And I'm going to show you some of the other stuff we can do with Eloquent up in the index.", 'start': 559.52, 'duration': 4.463}, {'end': 565.944, 'text': 'But I just want to get this settled first.', 'start': 564.263, 'duration': 1.681}, {'end': 569.206, 'text': 'So we know that this returns the single post.', 'start': 566.665, 'duration': 2.541}, {'end': 570.727, 'text': "So let's put it into a variable.", 'start': 569.226, 'duration': 1.501}, {'end': 572.769, 'text': "And then we're going to load the view.", 'start': 571.528, 'duration': 1.241}, {'end': 575.831, 'text': "So we'll say return view.", 'start': 573.069, 'duration': 2.762}, {'end': 579.013, 'text': "We're going to return.", 'start': 575.851, 'duration': 3.162}, {'end': 581.415, 'text': "It's going to be in the post folder.", 'start': 579.093, 'duration': 2.322}, {'end': 583.856, 'text': "And then it's going to be in a template called show.", 'start': 581.535, 'duration': 2.321}, {'end': 584.957, 'text': 'All right.', 'start': 583.876, 'duration': 1.081}, {'end': 586.498, 'text': "And then we're just going to pass along.", 'start': 585.037, 'duration': 1.461}, {'end': 594.428, 'text': "post and then the variable post, and that's it.", 'start': 589.284, 'duration': 5.144}, {'end': 598.071, 'text': 'so you can see how clean laravel is compared to something like code igniter.', 'start': 594.428, 'duration': 3.643}, {'end': 601.153, 'text': "all right, not to bash code igniter, it's just.", 'start': 598.071, 'duration': 3.082}, {'end': 605.677, 'text': "i think it's a good comparison, because i just i did a series on it.", 'start': 601.153, 'duration': 4.524}, {'end': 606.297, 'text': 'i do like it.', 'start': 605.677, 'duration': 0.62}, {'end': 609.54, 'text': "i think it's a great framework to learn mvc with.", 'start': 606.297, 'duration': 3.243}, {'end': 613.043, 'text': 'it was actually the first php framework that i learned.', 'start': 609.54, 'duration': 3.503}, {'end': 614.724, 'text': 'but i think laravel is much cleaner.', 'start': 613.043, 'duration': 1.681}, {'end': 616.953, 'text': 'All right.', 'start': 616.653, 'duration': 0.3}, {'end': 618.534, 'text': 'so now we have to create the show view.', 'start': 616.953, 'duration': 1.581}, {'end': 624.717, 'text': "So let's go to our post folder in the views and say new file, show.blade.php.", 'start': 618.574, 'duration': 6.143}, {'end': 628.339, 'text': "And let's see, we're going to do our extend.", 'start': 626.638, 'duration': 1.701}, {'end': 629.879, 'text': "I'm just going to copy this.", 'start': 628.359, 'duration': 1.52}], 'summary': 'The transcript discusses using eloquent in laravel to return a single post and create a show view, comparing laravel to codeigniter.', 'duration': 77.589, 'max_score': 552.29, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4552290.jpg'}], 'start': 146.107, 'title': 'Laravel basics and implementing looping in laravel', 'summary': "Introduces creating and using model and controller in laravel with a demonstration of retrieving all posts, and explains looping through posts, implementing links to individual post pages, and the simplicity of laravel's eloquent for fetching data.", 'chapters': [{'end': 331.731, 'start': 146.107, 'title': 'Laravel model and controller basics', 'summary': 'Introduces the basics of creating and using model and controller in laravel, including defining fields, setting up resource routes, creating views, and fetching data using eloquent, with a demonstration of retrieving all posts from the model.', 'duration': 185.624, 'highlights': ['The chapter introduces the basics of creating and using model and controller in Laravel. ', 'The process of defining fields, setting up resource routes, creating views, and fetching data using Eloquent is discussed. ', 'A demonstration of retrieving all posts from the model using Eloquent is provided. ']}, {'end': 629.879, 'start': 333.052, 'title': 'Implementing looping and linking in laravel', 'summary': "Explains how to loop through posts in laravel, implement links to individual post pages, and demonstrates the simplicity and cleanliness of laravel's eloquent for fetching data from the database.", 'duration': 296.827, 'highlights': ["The chapter demonstrates looping through posts in Laravel, checking if posts exist, and displaying 'no posts found' if there are none.", 'It explains how to create links to individual post pages using the show method and fetching data from the database using Eloquent in Laravel.', "The chapter highlights the simplicity and cleanliness of Laravel's Eloquent for fetching data from the database, comparing it to CodeIgniter and emphasizing Laravel's superiority."]}], 'duration': 483.772, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4146107.jpg', 'highlights': ['The chapter introduces the basics of creating and using model and controller in Laravel.', 'A demonstration of retrieving all posts from the model using Eloquent is provided.', 'The process of defining fields, setting up resource routes, creating views, and fetching data using Eloquent is discussed.', "The chapter demonstrates looping through posts in Laravel, checking if posts exist, and displaying 'no posts found' if there are none.", 'It explains how to create links to individual post pages using the show method and fetching data from the database using Eloquent in Laravel.', "The chapter highlights the simplicity and cleanliness of Laravel's Eloquent for fetching data from the database, comparing it to CodeIgniter and emphasizing Laravel's superiority."]}, {'end': 1169.513, 'segs': [{'end': 721.148, 'src': 'embed', 'start': 663.137, 'weight': 0, 'content': [{'end': 667.018, 'text': "So we'll go back and click on post one and you'll see that it gets the title.", 'start': 663.137, 'duration': 3.881}, {'end': 668.799, 'text': 'Okay, very simple.', 'start': 667.038, 'duration': 1.761}, {'end': 684.407, 'text': "Let's add our small tag here, and we'll just say written on post created at.", 'start': 670.697, 'duration': 13.71}, {'end': 689.41, 'text': "All right, and then we'll put the body in.", 'start': 684.587, 'duration': 4.823}, {'end': 691.572, 'text': "So I guess we'll just put this in a div.", 'start': 689.51, 'duration': 2.062}, {'end': 708.198, 'text': "Later on I'm going to show you how we can implement a WYSIWYG editor so that we can actually have a little section where we can choose headings and fonts and all that stuff.", 'start': 698.01, 'duration': 10.188}, {'end': 713.422, 'text': "And we'll actually save it as HTML, but for now it's just going to be plain text.", 'start': 708.758, 'duration': 4.664}, {'end': 716.344, 'text': "So let's take a look at that.", 'start': 715.043, 'duration': 1.301}, {'end': 718.966, 'text': 'And there we go.', 'start': 718.506, 'duration': 0.46}, {'end': 721.148, 'text': 'We have the title, the date, and the body.', 'start': 719.006, 'duration': 2.142}], 'summary': 'Demonstration of adding a title, date, and body to a post in a simple way', 'duration': 58.011, 'max_score': 663.137, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4663137.jpg'}, {'end': 786.548, 'src': 'embed', 'start': 753.599, 'weight': 2, 'content': [{'end': 770.786, 'text': "and we'll say go back and that's going to go to slash our slash posts and let's add a class of btn and then btn default.", 'start': 753.599, 'duration': 17.187}, {'end': 774.797, 'text': 'now we can go back, All right.', 'start': 770.786, 'duration': 4.011}, {'end': 778.04, 'text': 'so before I go, I just want to show you some other things we can do with Eloquent.', 'start': 774.797, 'duration': 3.243}, {'end': 781.323, 'text': "So let's go back up to the index where we're just selecting them all.", 'start': 778.08, 'duration': 3.243}, {'end': 784.586, 'text': "Now let's say we wanted to order it by something.", 'start': 782.404, 'duration': 2.182}, {'end': 786.548, 'text': "Let's say we want to order it by title.", 'start': 784.606, 'duration': 1.942}], 'summary': 'Demonstrating how to add a class and order items in eloquent by title.', 'duration': 32.949, 'max_score': 753.599, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4753599.jpg'}, {'end': 895.857, 'src': 'embed', 'start': 835.495, 'weight': 4, 'content': [{'end': 843.183, 'text': 'Now if you wanted to get an individual post, just like we did down in the show, and obviously you can use find, like we did,', 'start': 835.495, 'duration': 7.688}, {'end': 846.646, 'text': 'but you can also go like this', 'start': 843.183, 'duration': 3.463}, {'end': 851.211, 'text': 'You could say post equals the model and then where.', 'start': 846.686, 'duration': 4.525}, {'end': 858.974, 'text': 'And instead of getting it just by the ID like we did below, we could get it by title if we wanted.', 'start': 853.909, 'duration': 5.065}, {'end': 865.5, 'text': 'So we could say where title is post 2.', 'start': 859.654, 'duration': 5.846}, {'end': 867.261, 'text': 'And we have to add get to that.', 'start': 865.5, 'duration': 1.761}, {'end': 870.204, 'text': "And let's just return that.", 'start': 868.923, 'duration': 1.281}, {'end': 879.102, 'text': "And you'll see that it's only getting us post two and it's getting it by the title.", 'start': 874.858, 'duration': 4.244}, {'end': 880.283, 'text': "It's using a where clause.", 'start': 879.142, 'duration': 1.141}, {'end': 881.604, 'text': 'So we can do that as well.', 'start': 880.363, 'duration': 1.241}, {'end': 883.987, 'text': "I'm just going to comment these out or comment that out.", 'start': 881.724, 'duration': 2.263}, {'end': 891.874, 'text': "Now, what about not using Eloquent? Let's say you want to just use SQL queries for that.", 'start': 885.648, 'duration': 6.226}, {'end': 895.857, 'text': 'We can bring in the DB library by just doing use DB.', 'start': 891.974, 'duration': 3.883}], 'summary': 'Demonstrates retrieving a specific post using eloquent and sql queries, showcasing where clause and db library.', 'duration': 60.362, 'max_score': 835.495, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4835495.jpg'}, {'end': 1151.856, 'src': 'heatmap', 'start': 1097.924, 'weight': 6, 'content': [{'end': 1101.586, 'text': "So now if we go back, there's still only one.", 'start': 1097.924, 'duration': 3.662}, {'end': 1105.569, 'text': 'But we can put our pagination links down here very, very easily.', 'start': 1101.726, 'duration': 3.843}, {'end': 1109.492, 'text': "We'll just go right into our index and go under the foreach.", 'start': 1105.589, 'duration': 3.903}, {'end': 1112.794, 'text': 'Still in the if, but under the foreach.', 'start': 1110.973, 'duration': 1.821}, {'end': 1119.801, 'text': 'And all we have to do here is say posts links.', 'start': 1115.194, 'duration': 4.607}, {'end': 1121.583, 'text': "And that's it.", 'start': 1121.043, 'duration': 0.54}, {'end': 1122.445, 'text': 'Watch this.', 'start': 1122.004, 'duration': 0.441}, {'end': 1125.41, 'text': 'Reload Look at that.', 'start': 1124.11, 'duration': 1.3}, {'end': 1126.731, 'text': "They're even styled.", 'start': 1125.81, 'duration': 0.921}, {'end': 1129.831, 'text': 'So post one, we can go back to go to the next page.', 'start': 1127.171, 'duration': 2.66}, {'end': 1135.612, 'text': "Obviously, we want more than one per page, so I'm going to just change that to, let's say, 10.", 'start': 1130.671, 'duration': 4.941}, {'end': 1138.273, 'text': 'And then once we hit 11, the pagination will kick in.', 'start': 1135.612, 'duration': 2.661}, {'end': 1142.094, 'text': "Right now, it's not going to be there because, well, we only have two posts.", 'start': 1138.673, 'duration': 3.421}, {'end': 1145.415, 'text': 'All right, so you can see how easy that is with Laravel.', 'start': 1142.794, 'duration': 2.621}, {'end': 1151.856, 'text': 'In the next video, what I want to do is start to work on the form so that we can actually add posts through our application.', 'start': 1146.195, 'duration': 5.661}], 'summary': 'Demonstrating pagination with laravel, showing 2 posts and styling links. planning to add form for adding posts next.', 'duration': 53.932, 'max_score': 1097.924, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr41097924.jpg'}], 'start': 629.899, 'title': 'Implementing post viewing and using eloquent in laravel', 'summary': 'Covers implementing post viewing functionality and mentions the future wysiwyg editor, as well as using eloquent in laravel to cover ordering, retrieval, sql queries, limiting posts, and pagination, demonstrating its ease and benefits.', 'chapters': [{'end': 751.282, 'start': 629.899, 'title': 'Implementing post viewing functionality', 'summary': 'Demonstrates the process of displaying post details, including the title, date, and body, and also mentions the future implementation of a wysiwyg editor. it also includes the addition of a back button to the post view.', 'duration': 121.383, 'highlights': ['The chapter shows the process of displaying post details, including the title, date, and body.', 'The chapter mentions the future implementation of a WYSIWYG editor for user-friendly content creation.', 'It also includes the addition of a back button to the post view for improved navigation.']}, {'end': 1169.513, 'start': 753.599, 'title': 'Using eloquent in laravel', 'summary': 'Explains using eloquent in laravel, covering ordering, retrieving individual posts, using sql queries, limiting posts, and implementing pagination, demonstrating the ease and benefits of using eloquent over sql queries.', 'duration': 415.914, 'highlights': ['Demonstrating ordering posts by title using Eloquent Ordering by title in ascending and descending order, demonstrating the impact on post ordering', "Retrieving individual posts using Eloquent Fetching a post by title using the 'where' clause, highlighting the usage of 'where' to retrieve specific posts", 'Comparing Eloquent with SQL queries Introducing the use of SQL queries via the DB library and comparing it with Eloquent, emphasizing the preference for Eloquent over SQL queries', 'Implementing pagination with Eloquent Demonstrating the ease of implementing pagination with Eloquent, showcasing the simplicity of adding pagination links']}], 'duration': 539.614, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/emyIlJPxZr4/pics/emyIlJPxZr4629899.jpg', 'highlights': ['The chapter demonstrates the process of displaying post details, including the title, date, and body.', 'Future implementation of a WYSIWYG editor for user-friendly content creation is mentioned.', 'The addition of a back button to the post view for improved navigation is included.', 'Demonstrating ordering posts by title using Eloquent in ascending and descending order.', "Retrieving individual posts using Eloquent and highlighting the usage of 'where' to retrieve specific posts.", 'Introducing the use of SQL queries via the DB library and comparing it with Eloquent, emphasizing the preference for Eloquent over SQL queries.', 'Demonstrating the ease of implementing pagination with Eloquent, showcasing the simplicity of adding pagination links.']}], 'highlights': ['The video covers creating a post controller with resource functions like index, create, store, and a resource route in web.php, providing a structured approach to handling posts and routing.', 'The model file post.php is explained in detail, covering the functionality and customization options available, including table name, primary key field, and timestamps for records.', 'The chapter introduces the basics of creating and using model and controller in Laravel.', 'A demonstration of retrieving all posts from the model using Eloquent is provided.', 'The process of defining fields, setting up resource routes, creating views, and fetching data using Eloquent is discussed.', "The chapter demonstrates looping through posts in Laravel, checking if posts exist, and displaying 'no posts found' if there are none.", 'It explains how to create links to individual post pages using the show method and fetching data from the database using Eloquent in Laravel.', "The chapter highlights the simplicity and cleanliness of Laravel's Eloquent for fetching data from the database, comparing it to CodeIgniter and emphasizing Laravel's superiority.", 'The chapter demonstrates the process of displaying post details, including the title, date, and body.', 'Future implementation of a WYSIWYG editor for user-friendly content creation is mentioned.', 'The addition of a back button to the post view for improved navigation is included.', 'Demonstrating ordering posts by title using Eloquent in ascending and descending order.', "Retrieving individual posts using Eloquent and highlighting the usage of 'where' to retrieve specific posts.", 'Introducing the use of SQL queries via the DB library and comparing it with Eloquent, emphasizing the preference for Eloquent over SQL queries.', 'Demonstrating the ease of implementing pagination with Eloquent, showcasing the simplicity of adding pagination links.']}