title
Laravel Crash Course

description
This is a Laravel crash course that covers installation, authentication, routes, data, pagination, email functionality and much more - Visit Codecourse for more videos & courses by Alex: https://codecourse.com - YouTube Channel: https://www.youtube.com/channel/UCpOIUW62tnJTtpWFABxWZ8g - Code: https://github.com/codecourse/posty-traversy-media - Social Links: https://twitter.com/teamcodecourse https://twitter.com/alexjgarrett - Links mentioned in course: Composer (https://getcomposer.org/) Laravel documentation (https://laravel.com/docs/8.x) Laravel debugbar (https://github.com/barryvdh/laravel-debugbar) Tailwind (https://tailwindcss.com/) Mailtrap (https://mailtrap.io/) Timestamps: 00:00 Introduction 01:49 Demo 04:23 Installing and setting up Laravel 07:08 Routes, views and layouts 10:35 Laravel Mix and Tailwind 15:18 Styling the layout 17:35 Running migrations 22:57 Registering users 44:06 Signing in after registration 46:46 Authenticated state 48:30 Logging in 53:47 Logging out 57:52 Middleware 01:06:12 Post form 01:09:26 Setting up posts 01:16:06 User/post relationship 01:18:49 Creating a post 01:20:14 Listing posts 01:27:37 Pagination 01:30:31 Seeding with model factories 01:33:54 Liking and unliking posts 01:48:50 Eager loading 01:53:40 Deleting our posts 01:56:46 Authorization 02:02:47 User profile page 02:06:49 Blade components 02:10:54 Like count Eloquent relationship 02:12:41 Single post page 02:14:18 Sending email 02:21:23 Soft deleting models 02:26:31 Final tidying 02:28:20 Wrapping up

detail
{'title': 'Laravel Crash Course', 'heatmap': [{'end': 7600.272, 'start': 7507.403, 'weight': 1}], 'summary': "Tutorial on 'laravel crash course' covers building a post app with laravel, authentication, laravel mix, controllers, eloquent relationships, authorization, email sending, form validation, performance optimization, setting up laravel project, tailwind css integration, database management, user registration, authentication, logout, logging in, dashboard navigation, laravel middleware, post and user relationship, laravel functionalities, optimization, and enhancing user experience, data display, individual post page creation, email notification integration, and soft deletes in laravel.", 'chapters': [{'end': 228.673, 'segs': [{'end': 53.44, 'src': 'embed', 'start': 23.377, 'weight': 0, 'content': [{'end': 30.683, 'text': 'So I run CodeCourse.com where I teach Laravel, Vue, Slim, and loads of other topics, and the link for that is in the description.', 'start': 23.377, 'duration': 7.306}, {'end': 37.448, 'text': "So you can see the project that we're going to be building just here, but let's take a look at what we're going to be covering in this course.", 'start': 31.343, 'duration': 6.105}, {'end': 39.61, 'text': "So we're going to go through authentication.", 'start': 37.868, 'duration': 1.742}, {'end': 43.693, 'text': "We're going to look at Laravel Mix to pull in a CSS framework like Tailwind.", 'start': 39.71, 'duration': 3.983}, {'end': 53.44, 'text': "We're going to look at controllers, routing, root model, binding databases and migrations models, soft deleting, pluralization with Laravel,", 'start': 44.093, 'duration': 9.347}], 'summary': 'Codecourse.com teaches laravel, vue, slim, and more. course covers authentication, laravel mix, controllers, routing, models, migrations, and soft deleting.', 'duration': 30.063, 'max_score': 23.377, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE23377.jpg'}, {'end': 151.92, 'src': 'embed', 'start': 121.722, 'weight': 3, 'content': [{'end': 126.144, 'text': "uh, but let's go ahead and just sign in with my account here and let's just see what happens.", 'start': 121.722, 'duration': 4.422}, {'end': 130.406, 'text': "so we've got this remember me as well, which is handled automatically with laravel.", 'start': 126.144, 'duration': 4.262}, {'end': 132.827, 'text': "so we've got a dashboard over here which doesn't contain anything.", 'start': 130.406, 'duration': 2.421}, {'end': 140.69, 'text': "but that's what we're going to be using to protect with middleware, to prevent non-authenticated users accessing, and we have this post list here.", 'start': 132.827, 'duration': 7.863}, {'end': 143.832, 'text': 'so we already have a few posts here from another account.', 'start': 140.69, 'duration': 3.142}, {'end': 147.175, 'text': 'Now I can go ahead and like these, which will actually send an email.', 'start': 144.312, 'duration': 2.863}, {'end': 151.92, 'text': 'So that will have delivered an email to this user, regardless of what their email address is.', 'start': 147.215, 'duration': 4.705}], 'summary': 'Using laravel, a dashboard is accessed, and posts liked, triggering email delivery.', 'duration': 30.198, 'max_score': 121.722, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE121722.jpg'}, {'end': 228.673, 'src': 'embed', 'start': 190.35, 'weight': 4, 'content': [{'end': 195.772, 'text': 'OK, so what I can actually do here is click on any of these users to go through to a separate page.', 'start': 190.35, 'duration': 5.422}, {'end': 198.732, 'text': "So we're going to be looking at root model binding here,", 'start': 196.352, 'duration': 2.38}, {'end': 205.334, 'text': 'which is a really nice feature of Laravel that allows us to really quickly pick up the model based on whatever we pass in.', 'start': 198.732, 'duration': 6.602}, {'end': 207.635, 'text': "In this case, it's the user's username.", 'start': 205.374, 'duration': 2.261}, {'end': 215.021, 'text': "And we just have an overview here of all of the posts that a user has created and also how many likes they've received.", 'start': 208.255, 'duration': 6.766}, {'end': 219.725, 'text': 'And that will come into a slightly more complex, eloquent relationship.', 'start': 215.061, 'duration': 4.664}, {'end': 224.049, 'text': "So you can see here it's pretty much the same as the index view that we just saw.", 'start': 220.286, 'duration': 3.763}, {'end': 226.171, 'text': 'As this user, I can still like this.', 'start': 224.189, 'duration': 1.982}, {'end': 228.673, 'text': "Slight delay here because we're sending an email.", 'start': 226.711, 'duration': 1.962}], 'summary': 'Demonstrating root model binding in laravel for user posts and likes.', 'duration': 38.323, 'max_score': 190.35, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE190350.jpg'}], 'start': 7.093, 'title': 'Building laravel post app and authentication system', 'summary': 'Covers building a post app with laravel, including authentication, laravel mix, controllers, eloquent relationships, authorization, sending email, validating forms, performance optimization, and more. it also demonstrates building an authentication and authorization system with laravel, including user registration, login, post creation, like functionality, validation, root model binding, and complex eloquent relationships.', 'chapters': [{'end': 104.105, 'start': 7.093, 'title': 'Building a post app with laravel', 'summary': 'Covers building a post app with laravel, including authentication, laravel mix, controllers, eloquent relationships, authorization, sending email, validating forms, performance optimization, and more, packed into a fast-paced course.', 'duration': 97.012, 'highlights': ['The course covers authentication, Laravel Mix, controllers, eloquent relationships, authorization, sending email, validating forms, performance optimization, and more, providing an overview of as much as possible.', 'The project includes authentication, Laravel Mix, controllers, eloquent relationships, authorization, sending email, validating forms, performance optimization, and more, serving as a comprehensive demonstration of Laravel features.', 'The course is designed to cover a wide range of Laravel features, including authentication, Laravel Mix, controllers, eloquent relationships, authorization, sending email, validating forms, and performance optimization, offering a fast-paced learning experience.']}, {'end': 228.673, 'start': 104.225, 'title': 'Building authentication and authorization system with laravel', 'summary': 'Demonstrates building an authentication and authorization system with laravel, including user registration, login, post creation, like functionality, validation, root model binding, and complex eloquent relationships.', 'duration': 124.448, 'highlights': ['The chapter demonstrates user registration, login, and authentication with Laravel, including features like remember me functionality and dashboard creation.', 'The tutorial covers post creation, liking functionality, and preventing spam by not sending multiple emails when a post is liked multiple times.', 'The section includes demonstrations of post deletion, validation on post creation, and root model binding to quickly pick up the model based on the passed-in parameter.', "It also presents a slightly complex eloquent relationship to display all posts created by a user and the number of likes they've received, with the ability to like posts and the slight delay in sending an email."]}], 'duration': 221.58, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE7093.jpg', 'highlights': ['The course covers authentication, Laravel Mix, controllers, eloquent relationships, authorization, sending email, validating forms, performance optimization, and more, providing an overview of as much as possible.', 'The project includes authentication, Laravel Mix, controllers, eloquent relationships, authorization, sending email, validating forms, performance optimization, and more, serving as a comprehensive demonstration of Laravel features.', 'The course is designed to cover a wide range of Laravel features, including authentication, Laravel Mix, controllers, eloquent relationships, authorization, sending email, validating forms, and performance optimization, offering a fast-paced learning experience.', 'The chapter demonstrates user registration, login, and authentication with Laravel, including features like remember me functionality and dashboard creation.', 'The tutorial covers post creation, liking functionality, and preventing spam by not sending multiple emails when a post is liked multiple times.', 'The section includes demonstrations of post deletion, validation on post creation, and root model binding to quickly pick up the model based on the passed-in parameter.', "It also presents a slightly complex eloquent relationship to display all posts created by a user and the number of likes they've received, with the ability to like posts and the slight delay in sending an email."]}, {'end': 1059.927, 'segs': [{'end': 297.331, 'src': 'embed', 'start': 263.59, 'weight': 0, 'content': [{'end': 265.571, 'text': 'OK, so everything is cleared out now.', 'start': 263.59, 'duration': 1.981}, {'end': 267.773, 'text': 'We are completely starting from scratch.', 'start': 265.631, 'duration': 2.142}, {'end': 271.115, 'text': 'And the first thing we need to do, of course, is get Laravel installed.', 'start': 268.093, 'duration': 3.022}, {'end': 275.218, 'text': 'There are a few different ways to do this and a few different ways to serve Laravel projects.', 'start': 271.575, 'duration': 3.643}, {'end': 282.883, 'text': "But what we're going to do is just pull down the Laravel installer, the global composer installer, go ahead and create a new project with this.", 'start': 275.258, 'duration': 7.625}, {'end': 290.508, 'text': "And then we're going to serve this with the local artisan serve command, as well as just diving into artisan as well, just to see what this is.", 'start': 283.243, 'duration': 7.265}, {'end': 292.949, 'text': "So the first thing that you're going to need is Composer.", 'start': 291.008, 'duration': 1.941}, {'end': 295.13, 'text': "You may already have it if you're a PHP developer.", 'start': 293.109, 'duration': 2.021}, {'end': 297.331, 'text': "It's just a dependency manager for PHP.", 'start': 295.15, 'duration': 2.181}], 'summary': 'Starting from scratch, installing laravel with composer, and serving with artisan command.', 'duration': 33.741, 'max_score': 263.59, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE263590.jpg'}, {'end': 457.715, 'src': 'embed', 'start': 423.678, 'weight': 3, 'content': [{'end': 424.158, 'text': 'And there we go.', 'start': 423.678, 'duration': 0.48}, {'end': 428.22, 'text': 'Sure enough, we have a fresh Laravel project set up and ready to go.', 'start': 424.318, 'duration': 3.902}, {'end': 433.923, 'text': "So we're going to dive straight into our views, or in fact, our routes, first of all.", 'start': 428.92, 'duration': 5.003}, {'end': 435.563, 'text': "Let's go over to routes and web.", 'start': 434.083, 'duration': 1.48}, {'end': 439.766, 'text': 'So we have a routes directory here with API, channels, console, and web.', 'start': 435.924, 'duration': 3.842}, {'end': 442.487, 'text': "We're not going to touch these three in this course.", 'start': 440.126, 'duration': 2.361}, {'end': 444.548, 'text': 'They are, of course, for API development.', 'start': 442.567, 'duration': 1.981}, {'end': 450.931, 'text': 'Channels are for broadcasting, and console is for any artisan console commands that you want to register.', 'start': 444.968, 'duration': 5.963}, {'end': 452.872, 'text': "But for now, we're just focused on web.", 'start': 450.991, 'duration': 1.881}, {'end': 457.715, 'text': "You can see that we've got a simple route here, which is the home page of our application.", 'start': 453.032, 'duration': 4.683}], 'summary': 'Setting up a fresh laravel project with focus on web routes.', 'duration': 34.037, 'max_score': 423.678, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE423678.jpg'}, {'end': 542.166, 'src': 'embed', 'start': 515.892, 'weight': 6, 'content': [{'end': 524.856, 'text': 'So anytime you name a file blade.php, Laravel will treat this as a blade file, which you can then use the blade syntax within.', 'start': 515.892, 'duration': 8.964}, {'end': 530.279, 'text': "So I'm just going to create out a basic document layout here and let's just check out how this works first of all.", 'start': 525.536, 'duration': 4.743}, {'end': 535.222, 'text': "I'm just going to change the name of the title over here and let's go and create another page.", 'start': 530.619, 'duration': 4.603}, {'end': 542.166, 'text': "So inside of views, let's create a posts folder and let's create index.blade.php.", 'start': 535.322, 'duration': 6.844}], 'summary': 'Laravel treats blade.php files as blade files, demonstrating by creating a basic document layout and an index page.', 'duration': 26.274, 'max_score': 515.892, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE515892.jpg'}, {'end': 699.87, 'src': 'embed', 'start': 660.27, 'weight': 2, 'content': [{'end': 663.873, 'text': "So now that's finished, we want to do an overall npm install.", 'start': 660.27, 'duration': 3.603}, {'end': 672.721, 'text': 'And the reason for this is Laravel ships with a package JSON file, which basically contains all of the dependencies that we need to get this working.', 'start': 664.294, 'duration': 8.427}, {'end': 680.003, 'text': "Specifically, they'll run mix, which is what we're going to use to pull Tailwind into our project and compile all of our assets together.", 'start': 673.041, 'duration': 6.962}, {'end': 685.565, 'text': 'So if we do a general npm install here, then we can run the dev command that we saw just over here.', 'start': 680.364, 'duration': 5.201}, {'end': 686.946, 'text': "So let's open that back up again.", 'start': 685.625, 'duration': 1.321}, {'end': 691.347, 'text': 'And what that will do is it will compile all of our CSS, all of our JavaScript.', 'start': 687.346, 'duration': 4.001}, {'end': 696.649, 'text': "So once we've done that, we'll take a look at the output location and how this comes into our app.", 'start': 691.407, 'duration': 5.242}, {'end': 697.829, 'text': "Okay, so that's done.", 'start': 696.989, 'duration': 0.84}, {'end': 699.87, 'text': "Let's run that npm run dev command.", 'start': 697.869, 'duration': 2.001}], 'summary': 'Perform npm install to get dependencies and compile assets for laravel using mix.', 'duration': 39.6, 'max_score': 660.27, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE660270.jpg'}, {'end': 793.865, 'src': 'embed', 'start': 768.379, 'weight': 5, 'content': [{'end': 775.565, 'text': 'But we basically want to pipe Tailwind through post CSS so we get all of the Tailwind assets pulled in to our project.', 'start': 768.379, 'duration': 7.186}, {'end': 778.047, 'text': "And again, if you've not worked with Tailwind before, don't worry too much.", 'start': 775.585, 'duration': 2.462}, {'end': 781.95, 'text': 'You can do the same thing for Bootstrap and any other CSS framework.', 'start': 778.067, 'duration': 3.883}, {'end': 787.216, 'text': "So if we come all the way down here, we've actually got a section within Tailwind for Laravel Mix.", 'start': 782.49, 'duration': 4.726}, {'end': 793.865, 'text': 'So we can go and just require in Tailwind CSS and have all of them styles take place.', 'start': 787.637, 'duration': 6.228}], 'summary': 'Using tailwind with post css to incorporate tailwind assets into projects, applicable to other css frameworks as well.', 'duration': 25.486, 'max_score': 768.379, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE768379.jpg'}, {'end': 857.105, 'src': 'embed', 'start': 827.471, 'weight': 7, 'content': [{'end': 832.553, 'text': "So what's going to happen now is when we run npm run dev, that will run this webpack-mix.js file.", 'start': 827.471, 'duration': 5.082}, {'end': 837.696, 'text': "It will pull Tailwind in, and that's piped into app.css here.", 'start': 832.934, 'duration': 4.762}, {'end': 841.978, 'text': 'So that will include the base components and utilities of the Tailwind framework.', 'start': 838.056, 'duration': 3.922}, {'end': 845.88, 'text': "And it's going to be very similar, like I've said before, if you're using any other framework.", 'start': 842.278, 'duration': 3.602}, {'end': 849.662, 'text': "Okay, so now that we've done that, let's go over and run npm run dev again.", 'start': 846.48, 'duration': 3.182}, {'end': 857.105, 'text': 'There is an npm run watch command as well if you want to have this hanging in the background and waiting for any changes you make.', 'start': 849.982, 'duration': 7.123}], 'summary': 'Running npm run dev will execute webpack-mix.js, incorporating tailwind into app.css, and npm run watch can monitor changes.', 'duration': 29.634, 'max_score': 827.471, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE827471.jpg'}, {'end': 931.903, 'src': 'embed', 'start': 903.871, 'weight': 8, 'content': [{'end': 909.614, 'text': "And again, if we view the page source here, you can see that that's now pointing to the full URL for our application.", 'start': 903.871, 'duration': 5.743}, {'end': 917.897, 'text': "So we've got Tailwind pulled in, and even if you're using any other CSS framework, you can now just start to style out everything that you need.", 'start': 910.214, 'duration': 7.683}, {'end': 923.499, 'text': "So let's go and set the body here with a class of BG Gray 100.", 'start': 918.397, 'duration': 5.102}, {'end': 926.561, 'text': "And if you're not used to Tailwind, this might be a little bit weird.", 'start': 923.499, 'duration': 3.062}, {'end': 931.903, 'text': "It's a utility class CSS framework, so you might not want to use this.", 'start': 926.581, 'duration': 5.322}], 'summary': 'Using tailwind css framework to style the application, with a class of bg gray 100 for the body.', 'duration': 28.032, 'max_score': 903.871, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE903871.jpg'}], 'start': 229.153, 'title': 'Setting up laravel project and tailwind css for laravel application', 'summary': 'Discusses setting up a laravel project, covering the global composer installer, local artisan serve command, directory structure, and key files. it also demonstrates integrating tailwind css into a laravel application, including npm installation, asset compilation, and applying styles to enhance layout and design.', 'chapters': [{'end': 620.26, 'start': 229.153, 'title': 'Setting up laravel project', 'summary': "Discusses setting up a laravel project from scratch using the global composer installer, serving the project with the local artisan serve command, and exploring the directory structure and key files, with an emphasis on the env file, config directory, routes, and views. it also covers creating a basic document layout using laravel's blade templating engine and extending the layout to show a list of posts.", 'duration': 391.107, 'highlights': ['Setting up a Laravel project from scratch using the global composer installer The chapter covers the process of using the global composer installer to create a new Laravel project, providing a clear guide for beginners to set up their development environment.', "Serving the project with the local artisan serve command The use of the local artisan serve command to serve the Laravel project on PHP's local development server is demonstrated, ensuring that developers can easily test their projects during development.", 'Exploring the directory structure and key files, including the env file, config directory, routes, and views The chapter delves into the important files and directories within a Laravel project, such as the env file for configuration, the config directory, routes, and views, providing an essential understanding of the project structure.', "Creating a basic document layout using Laravel's blade templating engine The process of creating a basic document layout using Laravel's blade templating engine is explained, offering a fundamental understanding of how to structure and design views within a Laravel application."]}, {'end': 1059.927, 'start': 620.6, 'title': 'Setting up tailwind css for laravel application', 'summary': "Demonstrates the process of installing and integrating tailwind css into a laravel application, including npm installation, compiling assets, using laravel mix, and applying tailwind styles to the project, aiming to enhance the application's layout and design.", 'duration': 439.327, 'highlights': ['The process of installing and integrating Tailwind CSS into a Laravel application, including npm installation, compiling assets, using Laravel Mix, and applying Tailwind styles to the project. Tailwind CSS integration, npm installation, Laravel Mix, applying styles', 'Running npm install and npm run dev commands to compile CSS and JavaScript assets for the Laravel application. npm install, npm run dev, compiling assets', "Utilizing Laravel Mix to manage assets and control the inclusion of Tailwind CSS, along with referencing the compiled assets within the project's templates. Laravel Mix, managing assets, referencing compiled assets", 'Implementing Tailwind CSS through post CSS and webpack-mix.js to include base components and utilities of the framework into the app.css file. Implementing Tailwind CSS, post CSS, webpack-mix.js, including base components and utilities', "Styling the application using Tailwind utility classes and creating a basic layout for the application's content and navigation. Styling with Tailwind, creating basic layout, using utility classes"]}], 'duration': 830.774, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE229153.jpg', 'highlights': ['Setting up a Laravel project from scratch using the global composer installer', 'Serving the project with the local artisan serve command', 'The process of installing and integrating Tailwind CSS into a Laravel application, including npm installation, compiling assets, using Laravel Mix, and applying Tailwind styles to the project.', 'Exploring the directory structure and key files, including the env file, config directory, routes, and views', 'Running npm install and npm run dev commands to compile CSS and JavaScript assets for the Laravel application.', "Utilizing Laravel Mix to manage assets and control the inclusion of Tailwind CSS, along with referencing the compiled assets within the project's templates.", "Creating a basic document layout using Laravel's blade templating engine", 'Implementing Tailwind CSS through post CSS and webpack-mix.js to include base components and utilities of the framework into the app.css file.', "Styling the application using Tailwind utility classes and creating a basic layout for the application's content and navigation."]}, {'end': 2475.729, 'segs': [{'end': 1124.155, 'src': 'embed', 'start': 1060.488, 'weight': 0, 'content': [{'end': 1067.994, 'text': 'So if we just head over to the database folder within here, we have this folder here called Migrations.', 'start': 1060.488, 'duration': 7.506}, {'end': 1071.095, 'text': 'Now this will migrate by default three tables.', 'start': 1068.474, 'duration': 2.621}, {'end': 1076.696, 'text': "Once we've configured our database and we run the artisan migrate command,", 'start': 1071.595, 'duration': 5.101}, {'end': 1085.458, 'text': 'what these migrations will allow you to do is define out the database schema of every table you want to create in your application,', 'start': 1076.696, 'duration': 8.762}, {'end': 1088.079, 'text': 'including all of the columns just inside of here as well.', 'start': 1085.458, 'duration': 2.621}, {'end': 1090.22, 'text': 'And that will just create all of this for you.', 'start': 1088.619, 'duration': 1.601}, {'end': 1092.801, 'text': 'When you need to add a column, you create a new migration.', 'start': 1090.36, 'duration': 2.441}, {'end': 1096.602, 'text': 'When you need to remove a column, you create a new migration as well.', 'start': 1093.181, 'duration': 3.421}, {'end': 1103.204, 'text': "And all of these migrations have an up and a down method, which is essentially the reverse of whatever you're doing.", 'start': 1097.022, 'duration': 6.182}, {'end': 1108.406, 'text': 'So in this case, the reverse of creating a users table is to drop the users table.', 'start': 1103.284, 'duration': 5.122}, {'end': 1115.549, 'text': 'And if we were adding a username to a users table, we would drop that username column in the down migration.', 'start': 1108.726, 'duration': 6.823}, {'end': 1120.572, 'text': "Now, we're going to go ahead and configure our database, and we do that within our EMV file just here.", 'start': 1116.229, 'duration': 4.343}, {'end': 1124.155, 'text': "Now, it doesn't really matter what database software you're working with.", 'start': 1120.812, 'duration': 3.343}], 'summary': 'Database migrations in this system create three default tables and allow defining database schema for adding or removing columns.', 'duration': 63.667, 'max_score': 1060.488, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE1060488.jpg'}, {'end': 1380.479, 'src': 'embed', 'start': 1338.767, 'weight': 3, 'content': [{'end': 1345.111, 'text': 'So when you move this, say, to a production environment, you can just run one command and have your entire database schema,', 'start': 1338.767, 'duration': 6.344}, {'end': 1348.354, 'text': 'including any changes along the way, created.', 'start': 1345.111, 'duration': 3.243}, {'end': 1350.936, 'text': "So that's a brief look at migrations.", 'start': 1349.095, 'duration': 1.841}, {'end': 1355.44, 'text': "Let's go into models now, because by default, we had that user migration.", 'start': 1351.357, 'duration': 4.083}, {'end': 1364.829, 'text': "And if we open up app and models, we've actually got a default user model in here, which represents the data inside of our database via Eloquent,", 'start': 1356.041, 'duration': 8.788}, {'end': 1368.713, 'text': "which is Laravel's ORM or Object Relational Mapper.", 'start': 1364.829, 'duration': 3.884}, {'end': 1376.597, 'text': 'So we can use this user model now to create, update, and pretty much do anything with our data in our database.', 'start': 1369.133, 'duration': 7.464}, {'end': 1380.479, 'text': "Now let's practice this with our registration.", 'start': 1377.197, 'duration': 3.282}], 'summary': 'Laravel allows one-command database schema migration and offers a default user model for data manipulation.', 'duration': 41.712, 'max_score': 1338.767, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE1338767.jpg'}, {'end': 1896.094, 'src': 'embed', 'start': 1865.186, 'weight': 5, 'content': [{'end': 1869.97, 'text': 'So to get around this, what we need to do is use the cross-site request forgery helper within our form.', 'start': 1865.186, 'duration': 4.784}, {'end': 1871.451, 'text': "Let's just see what that's done.", 'start': 1870.41, 'duration': 1.041}, {'end': 1874.654, 'text': "So I'm going to go ahead and view the page source or open this up in the inspector.", 'start': 1871.551, 'duration': 3.103}, {'end': 1880.658, 'text': "And you can see that for our form now, we've got a hidden input in here with a value.", 'start': 1875.054, 'duration': 5.604}, {'end': 1886.483, 'text': 'That will be submitted along with the form, and that should then pass the cross-site request forgery check.', 'start': 1881.099, 'duration': 5.384}, {'end': 1896.094, 'text': "So that's how cross-site request forgery protection on any form that has a method of post, put, delete, patch, et cetera, any of them HTTP verbs.", 'start': 1886.963, 'duration': 9.131}], 'summary': 'Using cross-site request forgery helper in form for protection.', 'duration': 30.908, 'max_score': 1865.186, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE1865186.jpg'}, {'end': 1970.679, 'src': 'embed', 'start': 1944.4, 'weight': 6, 'content': [{'end': 1948.725, 'text': "You can see there's a huge amount in here that you can extract from this request object.", 'start': 1944.4, 'duration': 4.325}, {'end': 1952.727, 'text': "What we're interested in though are the items that we've actually submitted through.", 'start': 1949.185, 'duration': 3.542}, {'end': 1961.693, 'text': "So let's just die dump on request and we can either use get here to grab out a specific field or we can just use the shorthand property.", 'start': 1953.108, 'duration': 8.585}, {'end': 1965.775, 'text': 'So I can just grab the email like this and that will defer to that get method.', 'start': 1961.773, 'duration': 4.002}, {'end': 1968.357, 'text': 'So this is just a more convenient way of accessing it.', 'start': 1965.795, 'duration': 2.562}, {'end': 1970.679, 'text': "So let's just die dump on request email.", 'start': 1968.777, 'duration': 1.902}], 'summary': 'Extract specific items from the request object, such as the email.', 'duration': 26.279, 'max_score': 1944.4, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE1944400.jpg'}, {'end': 2057.152, 'src': 'embed', 'start': 2028.758, 'weight': 7, 'content': [{'end': 2030.999, 'text': 'So for the name, this is going to be required.', 'start': 2028.758, 'duration': 2.241}, {'end': 2035.762, 'text': 'We can also do things like pipe this and set a max of 255.', 'start': 2031.4, 'duration': 4.362}, {'end': 2038.603, 'text': 'All of these validation rules are over in the Laravel documentation.', 'start': 2035.762, 'duration': 2.841}, {'end': 2040.564, 'text': "We don't need to go through them all today.", 'start': 2038.643, 'duration': 1.921}, {'end': 2047.407, 'text': "So you can just head over to the Laravel docs and figure out which validation rules work for the kind of data you're working with.", 'start': 2041.084, 'duration': 6.323}, {'end': 2050.929, 'text': 'So we can do this or we can use an array here.', 'start': 2048.206, 'duration': 2.723}, {'end': 2053.75, 'text': 'So we can say required Max255.', 'start': 2051.049, 'duration': 2.701}, {'end': 2057.152, 'text': 'And this is helpful when you start to build your own validation rules as well.', 'start': 2053.77, 'duration': 3.382}], 'summary': "Laravel documentation provides validation rules for data, such as 'required' and 'max255'.", 'duration': 28.394, 'max_score': 2028.758, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2028758.jpg'}, {'end': 2088.905, 'src': 'embed', 'start': 2064.757, 'weight': 8, 'content': [{'end': 2071.96, 'text': "So for the username, we're going to just say that that's required, although you could use some kind of alphanumeric rule if you wanted to.", 'start': 2064.757, 'duration': 7.203}, {'end': 2074.181, 'text': 'For the email address, this is slightly different.', 'start': 2072.38, 'duration': 1.801}, {'end': 2078.463, 'text': "We want this to be a valid email address, so we can use the RFL's email rule.", 'start': 2074.202, 'duration': 4.261}, {'end': 2081.703, 'text': "And the password is required, but it's also confirmed.", 'start': 2078.842, 'duration': 2.861}, {'end': 2087.505, 'text': "And we're going to go back to why we called the password confirmation field underscore confirmed.", 'start': 2082.384, 'duration': 5.121}, {'end': 2088.905, 'text': 'So this is required.', 'start': 2087.905, 'duration': 1}], 'summary': "Username and password are required, email must be valid according to rfl's rule", 'duration': 24.148, 'max_score': 2064.757, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2064757.jpg'}, {'end': 2302.492, 'src': 'embed', 'start': 2275.209, 'weight': 9, 'content': [{'end': 2283.296, 'text': "So what we're going to do is look at, as well as when we are redirected back with that error bag that we can use to extract these errors out.", 'start': 2275.209, 'duration': 8.087}, {'end': 2292.503, 'text': 'we also get a helper which reads from old session data, which is really useful to save a bit of time for people if they have any validation errors.', 'start': 2283.296, 'duration': 9.207}, {'end': 2297.047, 'text': "So I'm just using the blade syntax here just to output old name.", 'start': 2292.904, 'duration': 4.143}, {'end': 2302.492, 'text': "I didn't speak about that, but that's basically the syntax to output something on the page.", 'start': 2297.568, 'duration': 4.924}], 'summary': 'Using blade syntax to extract and output validation errors.', 'duration': 27.283, 'max_score': 2275.209, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2275209.jpg'}, {'end': 2457.863, 'src': 'embed', 'start': 2432.99, 'weight': 11, 'content': [{'end': 2438.614, 'text': 'So we have a helper within Laravel that allows us to do this, and that is the hash facade.', 'start': 2432.99, 'duration': 5.624}, {'end': 2441.156, 'text': 'Now, a quick word about facades.', 'start': 2439.515, 'duration': 1.641}, {'end': 2443.818, 'text': "You'll see this used a lot in Laravel if you're new.", 'start': 2441.176, 'duration': 2.642}, {'end': 2450.42, 'text': "Facades are basically, well, they are facades, so they're a front for underlying functionality.", 'start': 2444.458, 'duration': 5.962}, {'end': 2454.282, 'text': "So what we're not actually calling here is a bunch of static methods.", 'start': 2450.46, 'duration': 3.822}, {'end': 2457.863, 'text': "That's not what we're doing when we use something like hash make.", 'start': 2454.582, 'duration': 3.281}], 'summary': "Laravel's hash facade simplifies calling underlying functionality, like hash make, using facades.", 'duration': 24.873, 'max_score': 2432.99, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2432990.jpg'}], 'start': 1060.488, 'title': 'Laravel database management', 'summary': 'Covers database migrations and schema in laravel, setting up local installation, using migrations to manage schema, demonstrating orm functionality, implementing form validation, and handling inline errors in forms.', 'chapters': [{'end': 1124.155, 'start': 1060.488, 'title': 'Database migrations and schema', 'summary': 'Explains the process of database migrations, highlighting that by default three tables are migrated, and it details the significance of migrations in defining the database schema and managing table modifications within an application.', 'duration': 63.667, 'highlights': ['The migrations within the database folder migrate three tables by default, and they allow the definition of the database schema for creating tables in the application.', 'Creating a new migration is necessary when adding or removing a column, and each migration includes an up and a down method for the respective actions.', 'Configuring the database is done within the EMV file, irrespective of the database software being used.']}, {'end': 1928.024, 'start': 1124.315, 'title': 'Setting up database and migrations in laravel', 'summary': "Covers setting up a local installation for laravel, switching database connections, using migrations to manage the database schema, creating and running migrations, and demonstrating the functionality of laravel's orm. it also delves into creating a controller, implementing cross-site request forgery protection, and discussing form validation and user authentication.", 'duration': 803.709, 'highlights': ['Switching database connections and ports for local installation The speaker explains the process of switching database connections and ports for the local installation and mentions the flexibility to adapt to different database software.', 'Running database migrations to manage the database schema The tutorial demonstrates running database migrations, creating a migration table, and ensuring the schema aligns with the defined code.', "Creating and using Laravel's ORM for database operations The chapter explores the usage of Laravel's ORM, specifically the default user model, for CRUD operations in the database.", 'Setting up a controller and defining routes for user registration The tutorial covers creating a controller, defining routes for user registration, and emphasizes the importance of maintaining a structured application with mapped routes.', "Implementing cross-site request forgery protection The tutorial explains the concept of cross-site request forgery protection and demonstrates its implementation using Laravel's helper within a form.", 'Discussing the process of form validation and user authentication The chapter mentions the necessity of form validation before storing user data and highlights the importance of user authentication, hinting at upcoming discussions on these topics.']}, {'end': 2125.366, 'start': 1928.024, 'title': 'Laravel request object and form validation', 'summary': "Discusses using the laravel request object to extract information about the current request, accessing specific fields like email, and implementing form validation with laravel's base controller, including defining validation rules for name, username, email, and password.", 'duration': 197.342, 'highlights': ["Using Laravel's request object to extract information about the current request. The request object contains a huge amount of information that can be extracted, including specific fields like email, and can be used to store data in the database.", "Implementing form validation with Laravel's base controller and defining validation rules for name, username, email, and password. The base controller has a validate method, which, if the validation fails, throws an exception and redirects the user back with an error bag containing all of the error information.", "Demonstrating how to define validation rules for fields like name, username, email, and password. Validation rules are defined for each field, such as 'required' for name and username, 'email' for email address, and 'confirmed' for the password, ensuring that the password confirmation field matches the password field."]}, {'end': 2475.729, 'start': 2125.386, 'title': 'Inline error handling in laravel', 'summary': 'Demonstrates how to handle inline errors in laravel forms, including displaying specific errors, maintaining input data after redirection, and storing user data securely using the hash facade.', 'duration': 350.343, 'highlights': ['The chapter demonstrates how to handle inline errors in Laravel forms. The transcript showcases the process of displaying specific errors for form submissions using the error directive, inline error handling, and the error bag to extract errors.', 'Maintaining input data after redirection is shown. The transcript explains the use of the old session data helper to maintain input data for users in case of validation errors, reducing the need to re-enter data.', 'Storing user data securely using the hash facade is explained. The use of the hash facade to securely store user passwords in the database is highlighted, emphasizing the importance of data security in the application.']}], 'duration': 1415.241, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE1060488.jpg', 'highlights': ['The migrations within the database folder migrate three tables by default, allowing the definition of the database schema.', 'Creating a new migration is necessary when adding or removing a column, and each migration includes an up and a down method.', 'Configuring the database is done within the EMV file, irrespective of the database software being used.', 'Running database migrations to manage the database schema, creating a migration table, and ensuring the schema aligns with the defined code.', "Creating and using Laravel's ORM for database operations, specifically the default user model, for CRUD operations.", "Implementing cross-site request forgery protection using Laravel's helper within a form.", "Using Laravel's request object to extract information about the current request, including specific fields like email.", "Implementing form validation with Laravel's base controller and defining validation rules for name, username, email, and password.", 'Demonstrating how to define validation rules for fields like name, username, email, and password.', 'The chapter demonstrates how to handle inline errors in Laravel forms using the error directive and the error bag to extract errors.', 'Maintaining input data after redirection is shown using the old session data helper to maintain input data for users in case of validation errors.', 'Storing user data securely using the hash facade to securely store user passwords in the database.']}, {'end': 3450.256, 'segs': [{'end': 2557.569, 'src': 'embed', 'start': 2530.135, 'weight': 1, 'content': [{'end': 2536.057, 'text': "So we're going to go ahead and use the redirect helper and we're going to choose the route that we want to redirect over.", 'start': 2530.135, 'duration': 5.922}, {'end': 2542.7, 'text': "Now, once we've registered, a user signed them in here, which we are going to do in a minute.", 'start': 2536.597, 'duration': 6.103}, {'end': 2544.341, 'text': 'where would we want to redirect them to??', 'start': 2542.7, 'duration': 1.641}, {'end': 2546.022, 'text': 'Well, probably the dashboard page.', 'start': 2544.541, 'duration': 1.481}, {'end': 2550.445, 'text': "We haven't created this out just yet, but we already know that's a pretty straightforward process.", 'start': 2546.282, 'duration': 4.163}, {'end': 2557.569, 'text': "So let's leave this just as it is for now, head over to our routes here, and I'm going to create out a new page just at the top here,", 'start': 2550.925, 'duration': 6.644}], 'summary': 'Using redirect helper to choose route for user sign-in and redirection to dashboard page.', 'duration': 27.434, 'max_score': 2530.135, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2530135.jpg'}, {'end': 2677.618, 'src': 'embed', 'start': 2650.383, 'weight': 0, 'content': [{'end': 2653.565, 'text': 'So over in our register controller we want to sign the user in just here.', 'start': 2650.383, 'duration': 3.182}, {'end': 2655.146, 'text': "There's a couple of ways that we can do this.", 'start': 2653.945, 'duration': 1.201}, {'end': 2661.649, 'text': "We can either use the auth facade, we've already spoken about what facades are, or we can use the auth helper.", 'start': 2655.186, 'duration': 6.463}, {'end': 2665.591, 'text': 'Now this is really useful when you just want to grab the currently authenticated user.', 'start': 2661.889, 'duration': 3.702}, {'end': 2667.973, 'text': 'So this will return to you a user model.', 'start': 2665.932, 'duration': 2.041}, {'end': 2672.695, 'text': "If the user's signed in, we'll get a user model, otherwise we'll get null.", 'start': 2667.993, 'duration': 4.702}, {'end': 2677.618, 'text': "So you can imagine this being really useful within your templates when you want to output maybe the user's name.", 'start': 2672.715, 'duration': 4.903}], 'summary': 'The transcript discusses methods for signing in users using the auth facade or auth helper, returning a user model if signed in.', 'duration': 27.235, 'max_score': 2650.383, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2650383.jpg'}, {'end': 2722.578, 'src': 'embed', 'start': 2689.342, 'weight': 2, 'content': [{'end': 2693.184, 'text': 'Now we can do this like we did when we created a user,', 'start': 2689.342, 'duration': 3.842}, {'end': 2700.827, 'text': 'so we could pass in the email address here from the request and we could pass in the password from the request.', 'start': 2693.184, 'duration': 7.643}, {'end': 2701.787, 'text': 'like so.', 'start': 2701.267, 'duration': 0.52}, {'end': 2704.969, 'text': "But there's a much easier way to do this.", 'start': 2702.368, 'duration': 2.601}, {'end': 2712.453, 'text': "The only reason we didn't do a quicker method here or a cleaner method here is because within this, we needed to hash the password.", 'start': 2705.349, 'duration': 7.104}, {'end': 2722.578, 'text': "But if you've got data like this, you can actually use the request only method to grab the email, and in this case, the password.", 'start': 2712.833, 'duration': 9.745}], 'summary': 'Creating a user with email and password using a request, including hashing the password.', 'duration': 33.236, 'max_score': 2689.342, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2689342.jpg'}, {'end': 2823.886, 'src': 'embed', 'start': 2797.792, 'weight': 3, 'content': [{'end': 2802.875, 'text': "Well, sure enough, what that's now given us back is an authenticated user with all of my information.", 'start': 2797.792, 'duration': 5.083}, {'end': 2808.28, 'text': "So now we know that we're signed in because auth user is returning a user object.", 'start': 2803.276, 'duration': 5.004}, {'end': 2812.962, 'text': 'Now with this, what we can do is start to update our navigation and have this kind of pull together.', 'start': 2808.82, 'duration': 4.142}, {'end': 2817.384, 'text': "So at the moment, we're seeing pretty much everything in here when we are actually authenticated.", 'start': 2813.322, 'duration': 4.062}, {'end': 2819.344, 'text': "So we don't need to see login and register.", 'start': 2817.424, 'duration': 1.92}, {'end': 2823.886, 'text': "Let's go back over to app.blade.php and see how we can do this.", 'start': 2819.885, 'duration': 4.001}], 'summary': 'Authentication process successfully returns user object, enabling customized navigation.', 'duration': 26.094, 'max_score': 2797.792, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2797792.jpg'}, {'end': 2910.169, 'src': 'embed', 'start': 2884.477, 'weight': 5, 'content': [{'end': 2889.199, 'text': "Let's really quickly just look at a better way to do this, or in my opinion, a better way to do this.", 'start': 2884.477, 'duration': 4.722}, {'end': 2892.721, 'text': 'We can actually use the special auth directive within Blade.', 'start': 2889.679, 'duration': 3.042}, {'end': 2897.343, 'text': 'So we could say, well, if the user is signed in, we can say auth and end auth.', 'start': 2893.121, 'duration': 4.222}, {'end': 2901.025, 'text': 'But if the user is a guest, we could say guest and end guest.', 'start': 2898.023, 'duration': 3.002}, {'end': 2906.867, 'text': "So this block will be shown when we are signed in, and this block will be shown when we're a guest, e.g.", 'start': 2901.325, 'duration': 5.542}, {'end': 2908.348, 'text': "we're not signed in.", 'start': 2907.187, 'duration': 1.161}, {'end': 2910.169, 'text': 'So that will work in exactly the same way.', 'start': 2908.648, 'duration': 1.521}], 'summary': 'Using the auth directive in blade allows for different content display based on user status.', 'duration': 25.692, 'max_score': 2884.477, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2884477.jpg'}, {'end': 2974.642, 'src': 'embed', 'start': 2945.778, 'weight': 6, 'content': [{'end': 2947.718, 'text': "Let's make sure we import that login controller.", 'start': 2945.778, 'duration': 1.94}, {'end': 2953.459, 'text': "So let's open this up and let's create out an index method which will be responsible for showing the form,", 'start': 2947.938, 'duration': 5.521}, {'end': 2957.62, 'text': 'and a store method which will be responsible for actually signing the user in.', 'start': 2953.459, 'duration': 4.161}, {'end': 2964.976, 'text': "So I'm going to return a view in here under auth and that will be .login and here we're going to actually sign the user in.", 'start': 2958.18, 'duration': 6.796}, {'end': 2967.361, 'text': "So I'm just going to write okay in a die and dump.", 'start': 2964.996, 'duration': 2.365}, {'end': 2969.999, 'text': 'Okay, so now we need to create this view.', 'start': 2968.058, 'duration': 1.941}, {'end': 2971.26, 'text': "Let's do that really quickly.", 'start': 2970.139, 'duration': 1.121}, {'end': 2974.642, 'text': "So under auth, let's create login.blade.php.", 'start': 2971.34, 'duration': 3.302}], 'summary': 'Creating login controller with index and store methods, returning view under auth', 'duration': 28.864, 'max_score': 2945.778, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2945778.jpg'}, {'end': 3052.023, 'src': 'embed', 'start': 3025.355, 'weight': 7, 'content': [{'end': 3029.856, 'text': "because we're not storing anything and we don't need to confirm the password when we sign in.", 'start': 3025.355, 'duration': 4.501}, {'end': 3032.557, 'text': 'So we just got required, required, and email.', 'start': 3029.956, 'duration': 2.601}, {'end': 3040.739, 'text': 'Okay, so now over on the register.blade.php file or in this case, the login.blade.php file.', 'start': 3033.197, 'duration': 7.542}, {'end': 3043.52, 'text': 'we are outputting the right error messages, so this should just work.', 'start': 3040.739, 'duration': 2.781}, {'end': 3052.023, 'text': 'If we come over and try that out and actually make sure we pull in our request object in here, we should see.', 'start': 3043.9, 'duration': 8.123}], 'summary': 'Configured login page for easy access and error handling.', 'duration': 26.668, 'max_score': 3025.355, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE3025355.jpg'}, {'end': 3094.824, 'src': 'embed', 'start': 3067.51, 'weight': 10, 'content': [{'end': 3070.271, 'text': 'Great So we can click that and now see them two error messages.', 'start': 3067.51, 'duration': 2.761}, {'end': 3072.752, 'text': 'Now, we already know how to sign a user in.', 'start': 3070.871, 'duration': 1.881}, {'end': 3074.133, 'text': 'We did it just here.', 'start': 3072.892, 'duration': 1.241}, {'end': 3077.914, 'text': 'So we can go ahead and over in our login controller, do this.', 'start': 3074.293, 'duration': 3.621}, {'end': 3079.995, 'text': 'And that will attempt the authentication.', 'start': 3077.934, 'duration': 2.061}, {'end': 3083.577, 'text': 'And then we can redirect the user over to their dashboard.', 'start': 3080.535, 'duration': 3.042}, {'end': 3086.458, 'text': "So we can do exactly the same thing once they've signed in.", 'start': 3083.617, 'duration': 2.841}, {'end': 3088.739, 'text': "So let's say redirect root dashboard.", 'start': 3086.598, 'duration': 2.141}, {'end': 3089.9, 'text': 'now with this.', 'start': 3089.219, 'duration': 0.681}, {'end': 3094.824, 'text': 'we might want to flash an error message if this fails.', 'start': 3089.9, 'duration': 4.924}], 'summary': 'Demonstrating authentication process and error handling in the login controller.', 'duration': 27.314, 'max_score': 3067.51, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE3067510.jpg'}, {'end': 3183.23, 'src': 'embed', 'start': 3152.781, 'weight': 8, 'content': [{'end': 3154.842, 'text': "Let's enter some incorrect information.", 'start': 3152.781, 'duration': 2.061}, {'end': 3158.744, 'text': 'And we should just be redirected back to that same page, which we are, which is great.', 'start': 3155.182, 'duration': 3.562}, {'end': 3163.425, 'text': 'So what we can now do is in the login template, we can output this at the top.', 'start': 3159.344, 'duration': 4.081}, {'end': 3170.507, 'text': "Now, within Laravel, we can use the session helper to check if we've got a key in our session and flashing messages.", 'start': 3163.925, 'duration': 6.582}, {'end': 3173.688, 'text': 'basically just put something in a session temporarily.', 'start': 3170.507, 'duration': 3.181}, {'end': 3179.989, 'text': 'So we can say, well, if we have session status, then we can just output something just at the top here.', 'start': 3173.828, 'duration': 6.161}, {'end': 3183.23, 'text': "So let's look at just outputting this plainly and then we'll style it up.", 'start': 3180.209, 'duration': 3.021}], 'summary': 'Incorporated error handling in login template using laravel session helper and flashing messages.', 'duration': 30.449, 'max_score': 3152.781, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE3152781.jpg'}, {'end': 3282.65, 'src': 'embed', 'start': 3255.446, 'weight': 9, 'content': [{'end': 3259.85, 'text': "So let's create out a get route to logout, which is already a red flag.", 'start': 3255.446, 'duration': 4.404}, {'end': 3266.816, 'text': 'This is vulnerable to a cross-site request forgery attack because if, via JavaScript or any other means,', 'start': 3260.55, 'duration': 6.266}, {'end': 3271.66, 'text': "someone redirected us to hit this logout page, we'd be signed out of our application.", 'start': 3266.816, 'duration': 4.844}, {'end': 3274.743, 'text': 'Ideally, we want to protect this with cross-site request forgery.', 'start': 3272.04, 'duration': 2.703}, {'end': 3277.025, 'text': "So let's go ahead and say logout controller.", 'start': 3275.223, 'duration': 1.802}, {'end': 3279.667, 'text': "Let's hook this up and just see what it looks like first of all.", 'start': 3277.065, 'duration': 2.602}, {'end': 3282.65, 'text': "It's reference store and let's call this logout.", 'start': 3280.027, 'duration': 2.623}], 'summary': 'Creating a vulnerable logout route susceptible to cross-site request forgery attack.', 'duration': 27.204, 'max_score': 3255.446, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE3255446.jpg'}], 'start': 2476.15, 'title': 'User registration, authentication, and logout', 'summary': 'Discusses user registration, authentication, and logout using laravel, including creating users, redirecting to specific routes, storing information in the database, implementing cross-site request forgery protection, and error message handling.', 'chapters': [{'end': 2755.879, 'start': 2476.15, 'title': 'User registration and authentication', 'summary': 'Discusses the process of user registration and authentication using laravel, including creating users, redirecting to specific routes, creating a dashboard page, and signing in users. it also highlights the use of helper methods to simplify the code.', 'duration': 279.729, 'highlights': ['The process of user registration and authentication in Laravel is made easier by using helper methods and facades, eliminating the need for complex code and manual injection of dependencies.', 'After successfully registering a user, the chapter demonstrates the process of redirecting to specific routes, such as a dashboard page, and creating corresponding controllers and views.', 'The chapter also discusses the method of signing in users using helper methods and passing user credentials through the request only method, simplifying the authentication process.']}, {'end': 3067.45, 'start': 2756.66, 'title': 'User registration and sign-in process', 'summary': 'Covers the process of user registration and sign-in, including storing information in the database, verifying user sign-in, updating navigation, and implementing a better way to handle sign-in status. it also explains the creation of a login controller, validation, and error message handling.', 'duration': 310.79, 'highlights': ['The chapter covers the process of user registration and sign-in, including storing information in the database, verifying user sign-in, updating navigation, and implementing a better way to handle sign-in status. user registration, user sign-in, database storage, navigation update', 'The process of user sign-in is verified by accessing the authenticated user information and confirming the presence of a user object. user sign-in verification, access authenticated user information', "The method of handling sign-in status is improved by utilizing the special auth directive within Blade, allowing different blocks of code to be shown based on the user's sign-in status. improved sign-in status handling, special auth directive in Blade", 'Creation of a login controller is explained, including defining routes, methods for showing the form and signing the user in. creation of login controller, defining routes and methods', 'Validation and error message handling are implemented in the login process, ensuring the correct input and displaying appropriate error messages. validation, error message handling, login process']}, {'end': 3450.256, 'start': 3067.51, 'title': 'User authentication and logout', 'summary': 'Covers user authentication, including error message handling and logout functionality, with a focus on implementing cross-site request forgery protection, as well as demonstrating the use of session helpers and the authentication method in laravel.', 'duration': 382.746, 'highlights': ['Implemented error message flashing and validation for invalid login details using Laravel session helpers and if statements. Implemented error message flashing and validation', 'Demonstrated the implementation of cross-site request forgery protection for user logout functionality through the use of form submission and post method. Demonstrated the implementation of cross-site request forgery protection', "Showcased the use of Laravel's authentication method for user sign-in and sign-out functionality, ensuring redirection to specific pages upon successful operations. Showcased the use of Laravel's authentication method"]}], 'duration': 974.106, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE2476150.jpg', 'highlights': ['The process of user registration and authentication in Laravel is made easier by using helper methods and facades, eliminating the need for complex code and manual injection of dependencies.', 'The chapter demonstrates the process of redirecting to specific routes after successfully registering a user, such as a dashboard page, and creating corresponding controllers and views.', 'The method of signing in users using helper methods and passing user credentials through the request only method simplifies the authentication process.', 'The chapter covers the process of user registration and sign-in, including storing information in the database, verifying user sign-in, updating navigation, and implementing a better way to handle sign-in status.', 'The process of user sign-in is verified by accessing the authenticated user information and confirming the presence of a user object.', "The method of handling sign-in status is improved by utilizing the special auth directive within Blade, allowing different blocks of code to be shown based on the user's sign-in status.", 'Creation of a login controller is explained, including defining routes, methods for showing the form and signing the user in.', 'Validation and error message handling are implemented in the login process, ensuring the correct input and displaying appropriate error messages.', 'Implemented error message flashing and validation for invalid login details using Laravel session helpers and if statements.', 'Demonstrated the implementation of cross-site request forgery protection for user logout functionality through the use of form submission and post method.', "Showcased the use of Laravel's authentication method for user sign-in and sign-out functionality, ensuring redirection to specific pages upon successful operations."]}, {'end': 3968.866, 'segs': [{'end': 3567.604, 'src': 'embed', 'start': 3544.805, 'weight': 0, 'content': [{'end': 3552.331, 'text': 'modify the request before they get to the root of your application or the core of your application and actually render out what you can see.', 'start': 3544.805, 'duration': 7.526}, {'end': 3558.297, 'text': 'So they basically act as a way to either prevent things from going to the next step or modifying things along the way.', 'start': 3552.672, 'duration': 5.625}, {'end': 3560.619, 'text': "We've also got these middleware groups as well.", 'start': 3558.897, 'duration': 1.722}, {'end': 3567.604, 'text': 'Because Laravel ships with API functionality built in, middleware for web is very different to API middleware.', 'start': 3560.659, 'duration': 6.945}], 'summary': 'Laravel middleware alters requests, preventing or modifying them, with different functionality for web and api.', 'duration': 22.799, 'max_score': 3544.805, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE3544805.jpg'}, {'end': 3728.896, 'src': 'embed', 'start': 3701.9, 'weight': 1, 'content': [{'end': 3708.283, 'text': "But for guest middleware, for example, if I'm signed in, I shouldn't be able to register a new account.", 'start': 3701.9, 'duration': 6.383}, {'end': 3709.083, 'text': "It doesn't make sense.", 'start': 3708.303, 'duration': 0.78}, {'end': 3720.031, 'text': 'So over on the register controller, we can apply this middleware to both of these routes using this and middleware.', 'start': 3709.523, 'duration': 10.508}, {'end': 3723.735, 'text': 'and guest like so.', 'start': 3721.934, 'duration': 1.801}, {'end': 3728.896, 'text': "So we shouldn't be able to access the index or the store method if we are already signed in.", 'start': 3724.055, 'duration': 4.841}], 'summary': 'Middleware prevents signed-in users from registering new accounts, ensuring access control.', 'duration': 26.996, 'max_score': 3701.9, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE3701900.jpg'}, {'end': 3974.89, 'src': 'embed', 'start': 3948.232, 'weight': 2, 'content': [{'end': 3952.815, 'text': "When we log in now, you can see we've got a remember token stored in here.", 'start': 3948.232, 'duration': 4.583}, {'end': 3957.298, 'text': 'And interestingly, if we head over to the database, that remember token is stored in there.', 'start': 3953.276, 'duration': 4.022}, {'end': 3959.5, 'text': 'So that will be taking that all for you.', 'start': 3957.598, 'duration': 1.902}, {'end': 3961.321, 'text': "You don't need to build this functionality yourself.", 'start': 3959.54, 'duration': 1.781}, {'end': 3965.223, 'text': 'Be taking the token in here, which is obviously hashed.', 'start': 3961.721, 'duration': 3.502}, {'end': 3968.866, 'text': 'And in here, it will look this up in the database so it knows who to sign in.', 'start': 3965.383, 'duration': 3.483}, {'end': 3971.928, 'text': "so we've pretty much covered authentication.", 'start': 3969.526, 'duration': 2.402}, {'end': 3974.89, 'text': "now let's move on then to the posts page.", 'start': 3971.928, 'duration': 2.962}], 'summary': 'Remember token stored in database for authentication, no need to build functionality. moving on to posts page.', 'duration': 26.658, 'max_score': 3948.232, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE3948232.jpg'}], 'start': 3450.436, 'title': 'Logging in, dashboard navigation, and laravel middleware', 'summary': "Covers logging in, setting padding, and dashboard navigation, highlighting the importance of being signed in. it also discusses laravel middleware, its role in modifying and preventing requests, application to routes and controllers, and features like personalization and 'remember me' functionality.", 'chapters': [{'end': 3489.833, 'start': 3450.436, 'title': 'Logging in and dashboard navigation', 'summary': 'Discusses the process of logging in, setting padding, and navigating to the dashboard, emphasizing the importance of being signed in to access the dashboard.', 'duration': 39.397, 'highlights': ['Setting padding to match items with a value of three.', 'Accessing the dashboard while being signed out, potentially showing information for a user meant to be signed in.', 'The dashboard is only meant for people who are signed in.']}, {'end': 3968.866, 'start': 3489.913, 'title': 'Laravel middleware overview', 'summary': "Discusses the use of middleware in laravel, explaining its role in modifying and preventing requests, and the different ways to apply middleware to routes and controllers, with an emphasis on the authenticate and guest middleware. it also covers extracting user data for personalization and implementing 'remember me' functionality for user login.", 'duration': 478.953, 'highlights': ['The chapter discusses the use of middleware in Laravel, explaining its role in modifying and preventing requests, and the different ways to apply middleware to routes and controllers. Middleware acts as a way to either prevent things from going to the next step or modifying things along the way, with different ways to apply middleware to routes and controllers.', 'It covers an emphasis on the authenticate and guest middleware. Emphasizes the usage of authenticate and guest middleware, which are used for checking user authentication and preventing access for signed-in users respectively.', "The chapter also covers extracting user data for personalization and implementing 'Remember Me' functionality for user login. Discusses extracting user data for personalization and implementing 'Remember Me' functionality for user login, explaining how to personalize user experience and enable persistent login sessions."]}], 'duration': 518.43, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE3450436.jpg', 'highlights': ['Middleware in Laravel modifies and prevents requests, applied to routes and controllers.', 'Usage of authenticate and guest middleware for user authentication and preventing access for signed-in users.', "Extracting user data for personalization and implementing 'Remember Me' functionality for user login."]}, {'end': 5220.166, 'segs': [{'end': 4046.822, 'src': 'embed', 'start': 4025.369, 'weight': 1, 'content': [{'end': 4034.494, 'text': "let's create out the index method in here and let's go ahead and just return the view that we had to start with, which was posts and index.", 'start': 4025.369, 'duration': 9.125}, {'end': 4035.594, 'text': 'Okay, great.', 'start': 4035.094, 'duration': 0.5}, {'end': 4041.178, 'text': 'So now over in app.blade.php, we can hook this up because the route now has a name.', 'start': 4035.855, 'duration': 5.323}, {'end': 4044.461, 'text': "So let's go ahead and hook that up to the post route.", 'start': 4041.739, 'duration': 2.722}, {'end': 4046.822, 'text': "Now we're not going to use any middleware to protect this.", 'start': 4044.961, 'duration': 1.861}], 'summary': "Creating index method, returning view 'posts' for post route.", 'duration': 21.453, 'max_score': 4025.369, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE4025369.jpg'}, {'end': 4199.9, 'src': 'embed', 'start': 4171.567, 'weight': 2, 'content': [{'end': 4175.269, 'text': 'So we can eventually in here actually store the post in the database.', 'start': 4171.567, 'duration': 3.702}, {'end': 4180.051, 'text': 'Now, the process for creating a model and a migration at the same time is a bit different.', 'start': 4175.849, 'duration': 4.202}, {'end': 4184.953, 'text': 'we already ended up with, in our application, a user model by default.', 'start': 4180.551, 'duration': 4.402}, {'end': 4186.975, 'text': "So we didn't need to create this model ourselves.", 'start': 4184.993, 'duration': 1.982}, {'end': 4190.256, 'text': 'But we can create models just as easily with artisan.', 'start': 4187.035, 'duration': 3.221}, {'end': 4191.937, 'text': 'And that is using make model.', 'start': 4190.475, 'duration': 1.462}, {'end': 4195.058, 'text': "Now, we're going to give this the singular version of the name.", 'start': 4191.957, 'duration': 3.101}, {'end': 4196.359, 'text': "So we're not going to call this post.", 'start': 4195.098, 'duration': 1.261}, {'end': 4197.459, 'text': "We're just going to call it post.", 'start': 4196.419, 'duration': 1.04}, {'end': 4199.9, 'text': 'And we could just run this on its own.', 'start': 4198.14, 'duration': 1.76}], 'summary': 'Using artisan, models can be created easily, like the user model, to store posts in the database.', 'duration': 28.333, 'max_score': 4171.567, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE4171567.jpg'}, {'end': 4588.591, 'src': 'embed', 'start': 4566.66, 'weight': 3, 'content': [{'end': 4575.584, 'text': "so let's go over to the user model and set up our first eloquent relationship, and these are very simple to kind of read and see what they're doing.", 'start': 4566.66, 'duration': 8.924}, {'end': 4577.866, 'text': "so let's say that a user has many pipes.", 'start': 4575.584, 'duration': 2.282}, {'end': 4581.227, 'text': 'we just define this out as a method on our user model.', 'start': 4577.866, 'duration': 3.361}, {'end': 4583.228, 'text': 'in here we return the relationship type.', 'start': 4581.227, 'duration': 2.001}, {'end': 4588.591, 'text': 'so in this case a user has many and we define out here the post.', 'start': 4583.228, 'duration': 5.363}], 'summary': 'Setting up the first eloquent relationship: a user has many posts.', 'duration': 21.931, 'max_score': 4566.66, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE4566660.jpg'}, {'end': 4710.696, 'src': 'embed', 'start': 4672.641, 'weight': 4, 'content': [{'end': 4678.769, 'text': "And you'll see a huge list of methods that you can use, for example, grabbing the average value of every given key.", 'start': 4672.641, 'duration': 6.128}, {'end': 4681.752, 'text': 'But again, all of that is listed on the Laravel documentation.', 'start': 4679.209, 'duration': 2.543}, {'end': 4688.019, 'text': "So once you start to get into Laravel, you'll see the benefit of collections and how you can use them to manipulate lists of data.", 'start': 4681.772, 'duration': 6.247}, {'end': 4690.802, 'text': "It's just a lot better than having a plain array.", 'start': 4688.059, 'duration': 2.743}, {'end': 4696.126, 'text': "So now that we know that this relationship is actually working, we've got a list of no items.", 'start': 4691.503, 'duration': 4.623}, {'end': 4700.109, 'text': "Let's just manually create one in the database just so we can see that this works.", 'start': 4696.526, 'duration': 3.583}, {'end': 4703.111, 'text': "So let's go ahead and set this to my user.", 'start': 4700.509, 'duration': 2.602}, {'end': 4705.252, 'text': "Let's say ABC for the body.", 'start': 4703.531, 'duration': 1.721}, {'end': 4709.395, 'text': "And let's use the now function just to fill in the created and updated that day.", 'start': 4705.633, 'duration': 3.762}, {'end': 4710.696, 'text': "So we've done that manually.", 'start': 4709.655, 'duration': 1.041}], 'summary': "Laravel's collections enable better data manipulation than plain arrays, as seen in the documentation.", 'duration': 38.055, 'max_score': 4672.641, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE4672641.jpg'}, {'end': 4761.918, 'src': 'embed', 'start': 4732.746, 'weight': 6, 'content': [{'end': 4738.608, 'text': 'So in this case, we can use either the request object or auth user to go into the post relationship.', 'start': 4732.746, 'duration': 5.862}, {'end': 4744.089, 'text': 'This time we do access it as a method because we are chaining on to create a record.', 'start': 4738.648, 'duration': 5.441}, {'end': 4750.632, 'text': 'and then all we need to pass in here is the body, and Laravel behind the scenes, using this relationship setup,', 'start': 4744.509, 'duration': 6.123}, {'end': 4753.634, 'text': 'will automatically fill in the user id for us.', 'start': 4750.632, 'duration': 3.002}, {'end': 4754.934, 'text': "so we don't need to do that.", 'start': 4753.634, 'duration': 1.3}, {'end': 4761.918, 'text': "so let's go ahead and say request body and let's check this out, and I'm actually going to return back here to redirect us back to the last page.", 'start': 4754.934, 'duration': 6.984}], 'summary': 'Using request object or auth user to create a post relationship in laravel, automatically filling in the user id.', 'duration': 29.172, 'max_score': 4732.746, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE4732746.jpg'}, {'end': 4824.214, 'src': 'embed', 'start': 4794.795, 'weight': 7, 'content': [{'end': 4799.658, 'text': 'That would return to you an array with body accessed with the value and the key body.', 'start': 4794.795, 'duration': 4.863}, {'end': 4803.221, 'text': "So that works a little bit nicer when we've pulled that up to one line.", 'start': 4799.838, 'duration': 3.383}, {'end': 4813.887, 'text': 'So we can now successfully post posts via that user relationship and then we can use a list inside of here to output all of that information.', 'start': 4803.721, 'duration': 10.166}, {'end': 4815.528, 'text': "So let's look at actually doing that now.", 'start': 4814.148, 'duration': 1.38}, {'end': 4824.214, 'text': 'So if we come over to the post controller what we now want to do is on the index pass some data down here so we can output it.', 'start': 4815.809, 'duration': 8.405}], 'summary': 'The transcript discusses accessing array values and posting user relationships, aiming to output data in the post controller.', 'duration': 29.419, 'max_score': 4794.795, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE4794795.jpg'}, {'end': 4882.508, 'src': 'embed', 'start': 4856.656, 'weight': 0, 'content': [{'end': 4861.981, 'text': "So for now, we're just going to use post get, making sure that we import the post model at the top just here.", 'start': 4856.656, 'duration': 5.325}, {'end': 4866.786, 'text': 'Now, how do we pass this down to our view so we can start to iterate over all of these posts?', 'start': 4862.642, 'duration': 4.144}, {'end': 4870.349, 'text': 'By the way, this will be a Laravel collection, like we saw earlier.', 'start': 4866.886, 'duration': 3.463}, {'end': 4874.262, 'text': 'Now, we can do that by passing this into an array in view.', 'start': 4870.939, 'duration': 3.323}, {'end': 4877.324, 'text': "So we're going to say posts and posts.", 'start': 4874.282, 'duration': 3.042}, {'end': 4882.508, 'text': 'So we want all of the posts for our application to be sent down to the posts index view.', 'start': 4877.604, 'duration': 4.904}], 'summary': 'Using post get, passing posts to view for iteration, laravel collection', 'duration': 25.852, 'max_score': 4856.656, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE4856656.jpg'}, {'end': 5075.934, 'src': 'embed', 'start': 5050.638, 'weight': 10, 'content': [{'end': 5055.542, 'text': 'Now, we know that if we go over to the user model, a user has many posts.', 'start': 5050.638, 'duration': 4.904}, {'end': 5061.947, 'text': 'But if we are iterating through a post, we want to be able to access the user who posted this.', 'start': 5056.062, 'duration': 5.885}, {'end': 5067.632, 'text': "But we can't do that at the moment because there's no relationship here that ties this back to a specific user.", 'start': 5062.368, 'duration': 5.264}, {'end': 5074.694, 'text': 'So what we do is we create our relationship in here, for example, user, and we return that this belongs to a user.', 'start': 5068.232, 'duration': 6.462}, {'end': 5075.934, 'text': 'Again, makes sense.', 'start': 5074.934, 'duration': 1}], 'summary': 'Establishing a user-post relationship for better access and functionality.', 'duration': 25.296, 'max_score': 5050.638, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE5050638.jpg'}, {'end': 5210.003, 'src': 'embed', 'start': 5183.054, 'weight': 11, 'content': [{'end': 5187.155, 'text': "Laravel has its own wrapper for this under illuminate, which is Laravel's namespace.", 'start': 5183.054, 'duration': 4.101}, {'end': 5192.036, 'text': 'and support, but this is essentially using the carbon library.', 'start': 5188.795, 'duration': 3.241}, {'end': 5197.558, 'text': 'so if you need to find out how to manipulate this date in any way or format this date in any particular way,', 'start': 5192.036, 'duration': 5.522}, {'end': 5202.5, 'text': 'you can just head over to the carbon documentation and find out what you can do with that library.', 'start': 5197.558, 'duration': 4.942}, {'end': 5205.301, 'text': 'now you can add your own dates to your database.', 'start': 5202.5, 'duration': 2.801}, {'end': 5210.003, 'text': 'of course you might have when a user first registered or something completely different,', 'start': 5205.301, 'duration': 4.702}], 'summary': "Laravel's illuminate supports carbon library for date manipulation and formatting, enabling users to add their own dates to the database.", 'duration': 26.949, 'max_score': 5183.054, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE5183054.jpg'}], 'start': 3969.526, 'title': 'Laravel post and user relationship', 'summary': "Covers creating post controller, model, and relationship with users in laravel, including defining routes, rendering views, and using eloquent relationship to define that a user has many posts. it also demonstrates creating and managing posts, accessing user's posts and manipulating date and time formats using carbon library and laravel's support.", 'chapters': [{'end': 4328.54, 'start': 3969.526, 'title': 'Creating post controller and model', 'summary': 'Covers creating a post controller, defining routes, rendering views, and creating a model and migration for a post in laravel.', 'duration': 359.014, 'highlights': ['Creating Post Controller and Model Discussed creating a post controller, defining routes, rendering views, and creating a model and migration for a post in Laravel.', 'Defining Routes and Rendering Views Explained defining routes for the post controller and rendering views for the index page.', 'Creating Model and Migration Detailed the process of creating a model and migration for the post, including the use of artisan commands and schema building.']}, {'end': 4690.802, 'start': 4328.98, 'title': 'Creating post and user relationship', 'summary': 'Explains how to create a relationship between posts and users, including creating the user id column and setting up an eloquent relationship to define that a user has many posts, and the benefits of using collections in laravel.', 'duration': 361.822, 'highlights': ['The chapter explains how to create a relationship between posts and users, including creating the user ID column and setting up an eloquent relationship to define that a user has many posts. It also discusses the benefits of using collections in Laravel.', 'The chapter shows how to create a user ID column and set up an eloquent relationship to define that a user has many posts.', 'It discusses the benefits of using collections in Laravel and how they can be used to manipulate lists of data.']}, {'end': 5010.502, 'start': 4691.503, 'title': 'Using laravel to create and manage posts', 'summary': "Demonstrates the process of creating and managing posts using laravel, including manually creating items in the database, accessing user's posts, and iterating through posts in the application.", 'duration': 318.999, 'highlights': ['Manually creating items in the database to demonstrate functionality, such as setting a user, providing body content, and using the now function to fill in created and updated dates. N/A', "Demonstrating the process of accessing user's posts and creating a post through a user using the request object or auth user, and how Laravel automatically fills in the user id using the relationship setup. N/A", 'Using one line of code to define the relationship, allowing the functionality of successfully posting through the user relationship and using a list to output all information. N/A', 'Using Eloquent methods in Laravel to retrieve all posts from the database and passing them to the view for iteration, including using the count method to check the number of posts and iterating through the posts using a foreach loop. N/A']}, {'end': 5220.166, 'start': 5011.102, 'title': 'Laravel relationships and date manipulation', 'summary': "Discusses creating relationships between models in laravel, accessing user information through post models, and manipulating date and time formats using carbon library and laravel's support.", 'duration': 209.064, 'highlights': ['Creating relationships between models The chapter explains how to create relationships between models in Laravel, enabling access to related user information through post models.', 'Accessing user information through post models It demonstrates accessing user information through post models by creating a relationship that ties a post back to a specific user, allowing direct access to user attributes like name or username.', 'Manipulating date and time formats using Carbon library The chapter explores the use of Carbon library in Laravel for manipulating date and time formats, providing a way to access and format created and updated date instances.']}], 'duration': 1250.64, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE3969526.jpg', 'highlights': ['Creating a post controller, defining routes, rendering views, and creating a model and migration for a post in Laravel.', 'Explained defining routes for the post controller and rendering views for the index page.', 'Detailed the process of creating a model and migration for the post, including the use of artisan commands and schema building.', 'Creating a relationship between posts and users, including creating the user ID column and setting up an eloquent relationship to define that a user has many posts.', 'Discussing the benefits of using collections in Laravel and how they can be used to manipulate lists of data.', 'Manually creating items in the database to demonstrate functionality, such as setting a user, providing body content, and using the now function to fill in created and updated dates.', "Demonstrating the process of accessing user's posts and creating a post through a user using the request object or auth user, and how Laravel automatically fills in the user id using the relationship setup.", 'Using one line of code to define the relationship, allowing the functionality of successfully posting through the user relationship and using a list to output all information.', 'Using Eloquent methods in Laravel to retrieve all posts from the database and passing them to the view for iteration, including using the count method to check the number of posts and iterating through the posts using a foreach loop.', 'Explaining how to create relationships between models in Laravel, enabling access to related user information through post models.', 'Demonstrating accessing user information through post models by creating a relationship that ties a post back to a specific user, allowing direct access to user attributes like name or username.', 'Exploring the use of Carbon library in Laravel for manipulating date and time formats, providing a way to access and format created and updated date instances.']}, {'end': 6605.993, 'segs': [{'end': 5374.276, 'src': 'embed', 'start': 5332.297, 'weight': 1, 'content': [{'end': 5340.4, 'text': 'And the reason for that is the length-aware paginator is iterable, as in the PHP interface, and it contains that collection.', 'start': 5332.297, 'duration': 8.103}, {'end': 5347.504, 'text': 'But, more importantly, this is only pulling back the first two results from our database table, which, of course,', 'start': 5340.941, 'duration': 6.563}, {'end': 5351.946, 'text': 'is saving a huge query coming back with potentially millions of records.', 'start': 5347.504, 'duration': 4.442}, {'end': 5355.347, 'text': 'Now what we want to do is output the pagination links.', 'start': 5352.606, 'duration': 2.741}, {'end': 5361.29, 'text': 'Now by default within Laravel, when you output pagination links, these are going to be styled up with Tailwind.', 'start': 5355.647, 'duration': 5.643}, {'end': 5364.531, 'text': "So we're using Tailwind, so this is going to look really great.", 'start': 5361.63, 'duration': 2.901}, {'end': 5369.354, 'text': "If you're using Bootstrap or anything else, you might need to build out a custom paginator.", 'start': 5364.551, 'duration': 4.803}, {'end': 5370.914, 'text': "But let's just check this out.", 'start': 5369.814, 'duration': 1.1}, {'end': 5374.276, 'text': "So if we have a count of posts, we're iterating through them.", 'start': 5371.114, 'duration': 3.162}], 'summary': 'Using length-aware paginator to pull back first two results, saving huge query and outputting styled pagination links.', 'duration': 41.979, 'max_score': 5332.297, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE5332297.jpg'}, {'end': 5461.811, 'src': 'embed', 'start': 5435.416, 'weight': 4, 'content': [{'end': 5440.842, 'text': "So when I refresh this, you can see there are no pagination links because we don't have more than 20 to show.", 'start': 5435.416, 'duration': 5.426}, {'end': 5448.506, 'text': "Now we're going to come over to the command line and we're going to use something called Tinker Laravel.", 'start': 5442.163, 'duration': 6.343}, {'end': 5453.228, 'text': 'Tinker, which allows us to boot into a shell to run commands within Laravel.', 'start': 5448.506, 'duration': 4.722}, {'end': 5461.811, 'text': "And we're going to do this and use the post factory to generate out a long list of posts for either testing purposes, e.g.", 'start': 5453.788, 'duration': 8.023}], 'summary': 'Generated over 20 posts using tinker laravel for testing purposes.', 'duration': 26.395, 'max_score': 5435.416, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE5435416.jpg'}, {'end': 5626.96, 'src': 'embed', 'start': 5594.917, 'weight': 0, 'content': [{'end': 5596.719, 'text': "You can see we're showing 20 on this page.", 'start': 5594.917, 'duration': 1.802}, {'end': 5599.161, 'text': 'And of course we can now paginate through.', 'start': 5597.079, 'duration': 2.082}, {'end': 5609.069, 'text': "so hopefully that's given you just a kind of glimpse at factories and how you can use them to either generate fake data out to seed your database or use these within testing.", 'start': 5599.161, 'duration': 9.908}, {'end': 5612.232, 'text': 'you can look at them a little bit further when you dive into that.', 'start': 5609.069, 'duration': 3.163}, {'end': 5616.996, 'text': "okay, so just for now, now that we know that's working, i'm going to go ahead and clear this database table out.", 'start': 5612.232, 'duration': 4.764}, {'end': 5622.46, 'text': "so let's do that now and let's go over and just start to post some of our own posts.", 'start': 5616.996, 'duration': 5.464}, {'end': 5626.96, 'text': "so i'm just going to say hey again and so on.", 'start': 5622.46, 'duration': 4.5}], 'summary': 'Demonstrated pagination with 20 items/page and clearing database table.', 'duration': 32.043, 'max_score': 5594.917, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE5594917.jpg'}, {'end': 5702.927, 'src': 'embed', 'start': 5672.06, 'weight': 3, 'content': [{'end': 5674.742, 'text': "And if you're following along, feel free to go ahead and copy this down.", 'start': 5672.06, 'duration': 2.682}, {'end': 5681.508, 'text': 'Okay, so we need to think now about how posts can have many likes and how users can like posts.', 'start': 5675.502, 'duration': 6.006}, {'end': 5684.391, 'text': "So for this, we're going to go ahead and make out a migration.", 'start': 5682.009, 'duration': 2.382}, {'end': 5686.393, 'text': 'And this is kind of going to be a pivot table.', 'start': 5684.491, 'duration': 1.902}, {'end': 5691.719, 'text': "We're not going to use many to many relationship here because I think things like likes doesn't make too much sense.", 'start': 5686.774, 'duration': 4.945}, {'end': 5695.022, 'text': "But we're going to go ahead and make out a migration.", 'start': 5691.799, 'duration': 3.223}, {'end': 5697.485, 'text': "I'm going to create out a likes table.", 'start': 5695.983, 'duration': 1.502}, {'end': 5702.927, 'text': "We're not going to create a model for this, although we could if we wanted to, but we'll see how this comes together in a minute.", 'start': 5697.645, 'duration': 5.282}], 'summary': 'Creating a migration for a likes table in the context of posts and users.', 'duration': 30.867, 'max_score': 5672.06, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE5672060.jpg'}], 'start': 5220.906, 'title': 'Laravel functionalities', 'summary': "Covers using carbon for date manipulation, implementing pagination with specific mention of diff for humans function and the paginate method, using length-aware paginators, and demonstrating factories for testing and seeding. it also focuses on implementing like and unlike functionality for posts, creating a migration for likes table, using laravel's string helper, and query count optimization using laravel debug bar.", 'chapters': [{'end': 5308.234, 'start': 5220.906, 'title': 'Using carbon and pagination in laravel', 'summary': 'Covers using carbon to manipulate date and time formats, and implementing pagination to efficiently display a large number of posts in laravel, with specific mention of using the diff for humans function to calculate time elapsed and the paginate method to limit the number of posts displayed per page.', 'duration': 87.328, 'highlights': ['The chapter covers using Carbon to manipulate date and time formats Explains the flexibility of formatting dates using Carbon, such as converting to time string, and the ability to manipulate dates in various ways.', 'Implementing pagination to efficiently display a large number of posts in Laravel Discusses the necessity of implementing pagination to avoid performance issues when dealing with a large number of posts in the database, with an example of using the paginate method to limit the number of posts displayed per page.', 'Specific mention of using the diff for humans function to calculate time elapsed Highlights the use of the diff for humans function in Carbon to calculate and display the time elapsed since a particular post was made, providing a user-friendly way to present time information.']}, {'end': 5612.232, 'start': 5308.494, 'title': 'Laravel pagination and factories', 'summary': 'Discusses using length-aware paginators in laravel to efficiently handle large data sets, and demonstrates using factories to generate fake data for testing and seeding databases.', 'duration': 303.738, 'highlights': ['Using length-aware paginators to efficiently handle large data sets The length-aware paginator in Laravel efficiently retrieves only the necessary data from the database, preventing the retrieval of potentially millions of records, and allows for easy iteration and output of pagination links.', "Demonstrating the use of factories to generate fake data for testing and seeding databases The use of Laravel's post factory and Tinker allows for the generation of a large number of fake posts, assigning them to specific user IDs, and providing a convenient way to seed databases for testing purposes."]}, {'end': 5853.914, 'start': 5612.232, 'title': 'Implementing like and unlike functionality', 'summary': 'Focuses on implementing like and unlike functionality for posts, including creating a migration for a likes table, setting up relationships, and manually adding likes to posts.', 'duration': 241.682, 'highlights': ['The chapter focuses on implementing like and unlike functionality for posts, including creating a migration for a likes table, setting up relationships, and manually adding likes to posts. implementing like and unlike functionality, creating a migration for a likes table, setting up relationships, manually adding likes to posts', 'The process involves creating a migration for a likes table, which includes a foreign user ID and post ID, using on delete cascade to handle deletion of likes, and setting up a relationship between posts and likes. creating a migration for a likes table, including foreign user ID and post ID, using on delete cascade, setting up a relationship between posts and likes', 'The chapter also includes manually adding likes to posts, creating a like model, and outputting the count of likes on the post index page. manually adding likes to posts, creating a like model, outputting the count of likes on the post index page']}, {'end': 6077.99, 'start': 5853.914, 'title': 'Laravel string helper and post like controller', 'summary': "Explains how to use laravel's string helper to pluralize a word, create a new controller for post likes, define routes, and utilize root model binding for automatic model resolution in a method.", 'duration': 224.076, 'highlights': ["How to use Laravel's string helper to pluralize a word The str class in Laravel's illuminate support contains static methods to manipulate strings, including pluralizing a word by passing the singular version and the count, resulting in automatic pluralization of the word based on the count.", "Creating a new controller for post likes and defining routes The tutorial demonstrates creating a separate controller for post likes, 'post like controller', and defining routes to handle post likes, emphasizing the benefits of splitting functionalities into separate controllers.", 'Utilizing root model binding for automatic model resolution The chapter introduces root model binding, enabling automatic resolution of a model in a method by specifying the model name, and optionally the key to look up in the database, streamlining the process of fetching a model by its ID.']}, {'end': 6605.993, 'start': 6078.01, 'title': 'Implementing post likes in laravel', 'summary': 'Explains how to implement post likes in laravel, covering creating relationships, adding likes, preventing multiple likes, and using method spoofing to handle delete requests, with a demonstration of query count optimization using laravel debug bar.', 'duration': 527.983, 'highlights': ['Implementing post likes and creating relationships in Laravel The chapter explains how to implement post likes, create relationships, and add likes, demonstrating the process of creating a liked by method and checking if a user has already liked a post.', "Preventing multiple likes by adding protection and using method spoofing for delete requests The chapter covers adding protection to prevent multiple likes, using method spoofing to handle delete requests, and implementing authorization by checking the user's likes relationship and using the delete method.", "Optimizing query count using Laravel Debug Bar The chapter demonstrates using Laravel Debug Bar to optimize query count for the list of posts by creating a new user, making posts for the user, and using the tool to monitor and analyze the application's performance."]}], 'duration': 1385.087, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE5220906.jpg', 'highlights': ['Demonstrating the use of factories to generate fake data for testing and seeding databases', 'Using length-aware paginators to efficiently handle large data sets', 'Implementing pagination to efficiently display a large number of posts in Laravel', 'The chapter focuses on implementing like and unlike functionality for posts, including creating a migration for a likes table, setting up relationships, and manually adding likes to posts', 'Optimizing query count using Laravel Debug Bar']}, {'end': 7818.905, 'segs': [{'end': 6696.275, 'src': 'embed', 'start': 6669.027, 'weight': 0, 'content': [{'end': 6675.029, 'text': "So what that means is it's accessing each of these tables and querying them for every single loop.", 'start': 6669.027, 'duration': 6.002}, {'end': 6676.469, 'text': "That's exactly what's happening.", 'start': 6675.089, 'duration': 1.38}, {'end': 6681.83, 'text': 'Now what we can do with Laravel is use eager loading to bundle these queries together.', 'start': 6677.049, 'duration': 4.781}, {'end': 6685.391, 'text': 'So, rather than one query for every single iteration,', 'start': 6681.87, 'duration': 3.521}, {'end': 6690.553, 'text': "we've just performed one query to pull in all the data we need and we map it up to each of these.", 'start': 6685.391, 'duration': 5.162}, {'end': 6692.553, 'text': 'And this is incredibly easy to do.', 'start': 6691.153, 'duration': 1.4}, {'end': 6696.275, 'text': 'It sounds complex, but within Laravel, we can do this really easily over here.', 'start': 6692.613, 'duration': 3.662}], 'summary': 'Utilize eager loading in laravel to bundle queries, reducing from one query per iteration to a single query for all data.', 'duration': 27.248, 'max_score': 6669.027, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE6669027.jpg'}, {'end': 6798.399, 'src': 'embed', 'start': 6772.966, 'weight': 1, 'content': [{'end': 6778.007, 'text': "With that important point out of the way, let's just look at what happens when we sign out and go over to posts.", 'start': 6772.966, 'duration': 5.041}, {'end': 6785.249, 'text': "You can see that we've got an error here because we're trying to access liked by on posts, but we're passing in a null value to this.", 'start': 6778.047, 'duration': 7.202}, {'end': 6787.27, 'text': "And that's because I've just signed us out.", 'start': 6785.269, 'duration': 2.001}, {'end': 6794.616, 'text': "So what we want to do is, before we do this check, we want to make sure the user's actually signed in before we show any of these like options,", 'start': 6787.79, 'duration': 6.826}, {'end': 6798.399, 'text': 'because, as we know, we need to be authenticated to do any of this.', 'start': 6794.616, 'duration': 3.783}], 'summary': 'Need to check user authentication before showing like options.', 'duration': 25.433, 'max_score': 6772.966, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE6772966.jpg'}, {'end': 7299.227, 'src': 'embed', 'start': 7273.096, 'weight': 2, 'content': [{'end': 7277.738, 'text': 'So you can write that out as a string or use class to put in the fully qualified namespace.', 'start': 7273.096, 'duration': 4.642}, {'end': 7281.759, 'text': "And the policy, which is our post policy that we've just created.", 'start': 7278.158, 'duration': 3.601}, {'end': 7287.261, 'text': 'So that tells Laravel that the post policy here is attached to this post model.', 'start': 7282.159, 'duration': 5.102}, {'end': 7291.723, 'text': "Now what we can do with this is use Laravel's native authorization.", 'start': 7288.061, 'duration': 3.662}, {'end': 7299.227, 'text': 'So for example, inside of the controller, we can use the shorthand authorize method.', 'start': 7291.923, 'duration': 7.304}], 'summary': "Using laravel's native authorization, attach post policy to post model.", 'duration': 26.131, 'max_score': 7273.096, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE7273096.jpg'}, {'end': 7600.272, 'src': 'heatmap', 'start': 7507.403, 'weight': 1, 'content': [{'end': 7516.166, 'text': "posts. we might have other things that we're showing for users as well, and let's say index.blade.php, let's copy, say the dashboard template,", 'start': 7507.403, 'duration': 8.763}, {'end': 7523.008, 'text': "just over here and let's output the user's name, just to make sure that this works, say username.", 'start': 7516.166, 'duration': 6.842}, {'end': 7527.849, 'text': 'so over in here we want to pass down the user like so.', 'start': 7523.008, 'duration': 4.841}, {'end': 7531.35, 'text': "And we want to pass down the user's post as well in just a minute.", 'start': 7528.589, 'duration': 2.761}, {'end': 7533.571, 'text': "Let's just check this out and see that it works.", 'start': 7531.83, 'duration': 1.741}, {'end': 7534.451, 'text': 'And sure enough, it does.', 'start': 7533.671, 'duration': 0.78}, {'end': 7539.033, 'text': "Now, at the moment, we are exposing the user ID, which isn't a massive issue.", 'start': 7535.011, 'duration': 4.022}, {'end': 7542.854, 'text': 'But maybe we want to change this around to use the username instead here.', 'start': 7539.073, 'duration': 3.781}, {'end': 7548.616, 'text': 'And I mentioned earlier, we can use a colon and choose the column name that we want to extract for root model binding.', 'start': 7542.894, 'duration': 5.722}, {'end': 7552.518, 'text': 'We have a username, and that kind of makes more sense in a URL.', 'start': 7549.056, 'duration': 3.462}, {'end': 7557.661, 'text': 'So when I click Alexander now, sure enough, we get the username for both Alex and Billy.', 'start': 7552.558, 'duration': 5.103}, {'end': 7561.704, 'text': "So that's how easy it is to switch over the column you're looking for with root model binding.", 'start': 7557.741, 'duration': 3.963}, {'end': 7566.107, 'text': "There is another way that you can do that directly within the model, but it's much easier to do that in the root.", 'start': 7561.724, 'duration': 4.383}, {'end': 7571.83, 'text': "So let's extract the user's posts out so we can iterate through them and then we'll look at that issue that I was just speaking about.", 'start': 7566.807, 'duration': 5.023}, {'end': 7574.492, 'text': "So I'm going to go ahead and say user post.", 'start': 7571.85, 'duration': 2.642}, {'end': 7581.776, 'text': "Now this time I'm not just going to say user posts because we want to remember eager load the user and the likes into this.", 'start': 7574.552, 'duration': 7.224}, {'end': 7587.18, 'text': "So we're going to go ahead and say posts with and again say user posts.", 'start': 7582.277, 'duration': 4.903}, {'end': 7590.943, 'text': "and likes and we're going to paginate this as well.", 'start': 7588.121, 'duration': 2.822}, {'end': 7594.267, 'text': "So let's make sure we add pagination in and again we'll just choose 20.", 'start': 7591.704, 'duration': 2.563}, {'end': 7600.272, 'text': 'We already know that pagination works so we can just go ahead and do this without testing it out.', 'start': 7594.267, 'duration': 6.005}], 'summary': "Implementing root model binding to display user's name and posts, and implementing pagination.", 'duration': 92.869, 'max_score': 7507.403, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE7507403.jpg'}, {'end': 7659.02, 'src': 'embed', 'start': 7630.602, 'weight': 3, 'content': [{'end': 7636.99, 'text': "So how do we get around this? Well, we can use a blade component, which is kind of like an include, but it's a little bit more powerful.", 'start': 7630.602, 'duration': 6.388}, {'end': 7639.733, 'text': "So let's go ahead and make out a component.", 'start': 7637.53, 'duration': 2.203}, {'end': 7641.835, 'text': "And let's just call this post.", 'start': 7640.594, 'duration': 1.241}, {'end': 7645.42, 'text': 'So that will have created for you over in the root directory.', 'start': 7642.256, 'duration': 3.164}, {'end': 7649.874, 'text': 'a view folder with components and post.', 'start': 7647.512, 'duration': 2.362}, {'end': 7653.136, 'text': "We don't necessarily need this, but we'll take a look at that in just a second.", 'start': 7650.254, 'duration': 2.882}, {'end': 7659.02, 'text': 'And now it will have also created out a components directory in views and post.', 'start': 7653.836, 'duration': 5.184}], 'summary': "Using a blade component to create a 'post' with a view folder and components directory.", 'duration': 28.418, 'max_score': 7630.602, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE7630602.jpg'}], 'start': 6606.393, 'title': 'Optimizing laravel and enhancing user experience', 'summary': 'Addresses reducing query counts with eager loading, optimizing query performance by reducing query count from 13 to 5, handling post deletion and authentication, implementing laravel authorization, and creating a reusable blade component for displaying user posts, leading to a clean and efficient user post display.', 'chapters': [{'end': 6772.546, 'start': 6606.393, 'title': 'Reducing query counts with eager loading', 'summary': 'Explains the n plus 1 problem where accessing each record introduces additional queries, causing the query count to increase, and demonstrates how to use eager loading in laravel to reduce the query count from 13 to 5, ultimately optimizing the query performance.', 'duration': 166.153, 'highlights': ['The N plus 1 problem is illustrated, where for every record output, additional queries are introduced, potentially resulting in well over 100 queries for a list of 100 posts.', 'The use of eager loading in Laravel is demonstrated, reducing the query count from 13 to 5 by bundling queries together and loading in all the necessary data with a single query.', 'The importance of considering query count when building relationships in Laravel is emphasized, highlighting the significance of optimizing query performance.', 'The impact of eager loading is quantified, with the reduction in queries from potentially well over 100 to just 5, showcasing the significant improvement in query performance.', 'The concept of eager loading in Laravel is explained, emphasizing its ease of use and effectiveness in optimizing query performance by loading in all the required data with a single query.']}, {'end': 7065.175, 'start': 6772.966, 'title': 'Handling post deletion and authentication', 'summary': 'Discusses implementing authentication checks before allowing post interactions, adding a delete option for posts, and ensuring that only the post owner can delete it.', 'duration': 292.209, 'highlights': ['Implementing authentication checks before allowing post interactions, such as likes, to ensure users are signed in, preventing unauthorized actions. authentication checks, null value error on posts', 'Adding a delete option for posts, utilizing cross-site request forgery and method spoofing, and ensuring that only the post owner can delete it. cross-site request forgery, method spoofing, post deletion']}, {'end': 7566.107, 'start': 7065.175, 'title': 'Laravel authorization and user post listing', 'summary': "Covers the implementation of laravel authorization using policies to restrict user actions, demonstrating the use of 'can' directive in blade templates and creating a user post listing page with route model binding and customizing the url structure, ultimately achieving a clean and efficient user post display.", 'duration': 500.932, 'highlights': ['The chapter covers the implementation of Laravel authorization using policies to restrict user actions Demonstrates the use of policies to restrict user actions, ensuring security and control over user operations.', "demonstrating the use of 'can' directive in Blade templates Illustrates the usage of 'can' directive in Blade templates to control the visibility of certain actions based on user permissions, enhancing the user interface and experience.", 'creating a user post listing page with route model binding and customizing the URL structure Details the process of creating a user post listing page with route model binding, optimizing the URL structure for improved user experience and navigation.']}, {'end': 7818.905, 'start': 7566.807, 'title': 'Blade component for reusable posts', 'summary': "Demonstrates creating a reusable blade component 'post' to encapsulate the markup and logic for displaying user posts, addressing code duplication and enhancing maintainability.", 'duration': 252.098, 'highlights': ["The chapter demonstrates creating a reusable blade component 'post' to encapsulate the markup and logic for displaying user posts, addressing code duplication and enhancing maintainability.", "The speaker explains the process of creating a blade component 'post' to encapsulate the markup and logic for displaying user posts, removing the need for duplicating a huge amount of code.", "The speaker discusses the use of the 'props' directive to define the data that needs to be passed into the blade component, ensuring its reusability and flexibility.", "The chapter showcases the implementation of a reusable blade component 'post' to efficiently display user posts, enhancing the structure and maintainability of the codebase."]}], 'duration': 1212.512, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE6606393.jpg', 'highlights': ['Eager loading in Laravel reduces query count from 13 to 5, significantly improving query performance.', 'Implementing authentication checks prevents unauthorized actions and null value errors on posts.', 'Laravel authorization using policies ensures security and control over user operations.', "Creating a reusable blade component 'post' enhances maintainability and code structure."]}, {'end': 8935.701, 'segs': [{'end': 7947.635, 'src': 'embed', 'start': 7898.364, 'weight': 0, 'content': [{'end': 7899.725, 'text': 'how many things we have liked.', 'start': 7898.364, 'duration': 1.361}, {'end': 7903.688, 'text': 'So we actually need a different relationship type in here.', 'start': 7900.206, 'duration': 3.482}, {'end': 7905.449, 'text': "Let's think about what we're doing.", 'start': 7904.308, 'duration': 1.141}, {'end': 7907.651, 'text': "We know that we've got three posts as Billy.", 'start': 7905.709, 'duration': 1.942}, {'end': 7911.634, 'text': 'We want to find out how many likes we have via all of these posts.', 'start': 7907.831, 'duration': 3.803}, {'end': 7916.879, 'text': 'Laravel has a special relationship type for this to access things from a distant model.', 'start': 7912.155, 'duration': 4.724}, {'end': 7925.606, 'text': 'So for example, received likes, this relationship would be a has many through relationship.', 'start': 7917.299, 'duration': 8.307}, {'end': 7929.91, 'text': 'We have many likes through many posts.', 'start': 7926.006, 'duration': 3.904}, {'end': 7939.033, 'text': "posts And because we've set things up to Laravel's conventions, this is now going to give our received likes.", 'start': 7931.27, 'duration': 7.763}, {'end': 7943.574, 'text': "So let's go over to our page here, say received likes count.", 'start': 7939.053, 'duration': 4.521}, {'end': 7944.974, 'text': 'Sure enough, we get three.', 'start': 7944.054, 'duration': 0.92}, {'end': 7947.635, 'text': "Let's unlike this just to make sure that's working.", 'start': 7945.014, 'duration': 2.621}], 'summary': "Using laravel's has many through relationship, we found 3 received likes via 3 posts.", 'duration': 49.271, 'max_score': 7898.364, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE7898364.jpg'}, {'end': 7994.281, 'src': 'embed', 'start': 7966.762, 'weight': 5, 'content': [{'end': 7971.604, 'text': 'But before we do that, I want an individual page that just shows one post.', 'start': 7966.762, 'duration': 4.842}, {'end': 7975.146, 'text': "And since we've already created a component, this is going to be really simple.", 'start': 7971.784, 'duration': 3.362}, {'end': 7980.73, 'text': "So let's go over to our post controller and again, because we're keeping this nice and restful,", 'start': 7975.806, 'duration': 4.924}, {'end': 7986.475, 'text': "we're going to create out a show method in here which will take a post in via root model binding.", 'start': 7980.73, 'duration': 5.745}, {'end': 7994.281, 'text': "It will return a view here which is going to be something like post.show and it's going to pass that post down.", 'start': 7986.995, 'duration': 7.286}], 'summary': 'Create individual page showing one post with a show method.', 'duration': 27.519, 'max_score': 7966.762, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE7966762.jpg'}, {'end': 8111.2, 'src': 'embed', 'start': 8081.652, 'weight': 2, 'content': [{'end': 8083.132, 'text': 'We kind of want to just test this out.', 'start': 8081.652, 'duration': 1.48}, {'end': 8086.534, 'text': "And that's why I use Mail Trap to configure this.", 'start': 8083.152, 'duration': 3.382}, {'end': 8093.001, 'text': "If you have only one inbox in MailTrap, so I'm already signed in here, it's completely free.", 'start': 8087.054, 'duration': 5.947}, {'end': 8095.885, 'text': "So let's go ahead and add an inbox here called Posty.", 'start': 8093.662, 'duration': 2.223}, {'end': 8099.769, 'text': "So if you're following along, go ahead and sign up and create out a mailbox.", 'start': 8095.925, 'duration': 3.844}, {'end': 8102.973, 'text': 'And this is basically just like a normal email inbox.', 'start': 8100.21, 'duration': 2.763}, {'end': 8107.058, 'text': "You've got a host, a port, username and password, and some level of authentication.", 'start': 8103.013, 'duration': 4.045}, {'end': 8111.2, 'text': 'And we can actually set this up over in Laravel under the mail section.', 'start': 8107.538, 'duration': 3.662}], 'summary': 'Using mailtrap for testing, free for one inbox, set up in laravel mail section', 'duration': 29.548, 'max_score': 8081.652, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE8081652.jpg'}, {'end': 8168.665, 'src': 'embed', 'start': 8140.673, 'weight': 3, 'content': [{'end': 8144.135, 'text': 'So over on dashboard I want to refresh this page and have an email sent.', 'start': 8140.673, 'duration': 3.462}, {'end': 8150.539, 'text': 'Now, how do we create out an email within Laravel that we can send to a particular user or a group of users?', 'start': 8144.616, 'duration': 5.923}, {'end': 8157.841, 'text': "Let's run phpArtisan and you can see in the make section we have mail which will create an email class.", 'start': 8151.199, 'duration': 6.642}, {'end': 8164.383, 'text': "Now we're going to be covering markdown mail, but you can customize emails to just be plain text if you want,", 'start': 8158.341, 'duration': 6.042}, {'end': 8168.665, 'text': 'or just use templates or create your own template within a single mailable.', 'start': 8164.383, 'duration': 4.282}], 'summary': 'Using laravel, create and send customized emails to users or groups.', 'duration': 27.992, 'max_score': 8140.673, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE8140673.jpg'}, {'end': 8554.923, 'src': 'embed', 'start': 8529.919, 'weight': 6, 'content': [{'end': 8536.044, 'text': "when a like has been created, when we unlike something, we know that we're deleting this physically from the database,", 'start': 8529.919, 'duration': 6.125}, {'end': 8537.425, 'text': "so it's physically being removed.", 'start': 8536.044, 'duration': 1.381}, {'end': 8541.77, 'text': "But what we're instead going to do is set this up so we use something called soft deletes.", 'start': 8538.045, 'duration': 3.725}, {'end': 8546.074, 'text': 'And soft deletes can apply to any model, so anything can be soft deleted.', 'start': 8542.27, 'duration': 3.804}, {'end': 8554.923, 'text': "And all this means is that when, for example, you delete a user or any other model, even a post, It doesn't physically remove it from the database.", 'start': 8546.555, 'duration': 8.368}], 'summary': 'Soft deletes allow preserving data without physically removing it from the database.', 'duration': 25.004, 'max_score': 8529.919, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE8529919.jpg'}, {'end': 8893.01, 'src': 'embed', 'start': 8868.246, 'weight': 7, 'content': [{'end': 8875.408, 'text': "But the only problem with this is now we can't access the post page because we're applying this middleware to every method inside of here.", 'start': 8868.246, 'duration': 7.162}, {'end': 8881.529, 'text': 'How do we fix this up? Well, we can actually use except or only.', 'start': 8875.808, 'duration': 5.721}, {'end': 8890.108, 'text': 'So I could say, well, I only want this middleware to apply to store and destroy all of the other methods I want to allow guests.', 'start': 8881.829, 'duration': 8.279}, {'end': 8891.269, 'text': "So let's try this out.", 'start': 8890.368, 'duration': 0.901}, {'end': 8893.01, 'text': "Let's go over to posts that works.", 'start': 8891.289, 'duration': 1.721}], 'summary': 'Middleware issue resolved using except or only for specific methods.', 'duration': 24.764, 'max_score': 8868.246, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE8868246.jpg'}, {'end': 8935.701, 'src': 'embed', 'start': 8927.336, 'weight': 8, 'content': [{'end': 8931.458, 'text': "just to dive even further into the concepts that we've covered here today.", 'start': 8927.336, 'duration': 4.122}, {'end': 8935.701, 'text': "Thanks for watching, and I'll see you over on CodeCourse.com if you'd like to learn more.", 'start': 8931.898, 'duration': 3.803}], 'summary': 'Further exploration of covered concepts on codecourse.com.', 'duration': 8.365, 'max_score': 8927.336, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE8927336.jpg'}], 'start': 7819.445, 'title': 'Laravel features', 'summary': "Covers data display and relationship management, individual post page creation, email notification integration, and implementing soft deletes in laravel, with examples of using laravel's relationship types, like count display, email notification setup, and soft delete implementation.", 'chapters': [{'end': 7966.642, 'start': 7819.445, 'title': 'Data display and relationship management', 'summary': "Discusses displaying the post count and like count for a user, utilizing laravel's relationship types, and demonstrates using the 'has many through' relationship to access likes through posts, ultimately achieving a total like count for a user.", 'duration': 147.197, 'highlights': ['The chapter discusses displaying the post count and like count for a user It explains the process of displaying the number of posts and likes received by a user on a Laravel platform, emphasizing the importance of data display in user management.', "Utilizing Laravel's relationship types The transcript emphasizes the use of Laravel's relationship types, such as 'has many through' relationship, to efficiently access and manage data associations within the platform.", "Demonstrates using the 'has many through' relationship to access likes through posts The transcript demonstrates implementing the 'has many through' relationship in Laravel to access likes associated with user's posts, providing a clear example of relationship management in the context of data retrieval."]}, {'end': 8512.606, 'start': 7966.762, 'title': 'Individual post page and email notification', 'summary': 'Discusses creating an individual post page using a post controller and a show method, integrating email functionality using mail trap for testing purposes, and sending customizable email notifications when a post is liked, including the process of creating and sending the email.', 'duration': 545.844, 'highlights': ['Creating an individual post page using a post controller and a show method, passing the post down as a prop, and registering the route for the show method alongside other posts. The chapter discusses creating an individual post page using a post controller and a show method, passing the post down as a prop, and registering the route for the show method alongside other posts.', 'Integrating email functionality using Mail Trap for testing purposes, configuring the mail settings in Laravel, and sending a test email to ensure mail setup is ready. The chapter covers integrating email functionality using Mail Trap for testing purposes, configuring the mail settings in Laravel, and sending a test email to ensure mail setup is ready.', "Creating a mailable email class using Laravel's make mail command, customizing email templates using markdown, and sending customizable email notifications when a post is liked. The chapter explains creating a mailable email class using Laravel's make mail command, customizing email templates using markdown, and sending customizable email notifications when a post is liked."]}, {'end': 8935.701, 'start': 8513.226, 'title': 'Implementing soft deletes in laravel', 'summary': 'Discusses the implementation of soft deletes in laravel, allowing for the retention of sensitive information in the database while preventing the re-sending of emails upon unliking a post, and the utilization of middleware to restrict unauthenticated users from posting.', 'duration': 422.475, 'highlights': ['Implementation of Soft Deletes The implementation of soft deletes in Laravel is discussed, allowing for the retention of sensitive information in the database while preventing the re-sending of emails upon unliking a post.', "Utilization of Middleware The usage of middleware to restrict unauthenticated users from posting is explained, demonstrating the use of 'auth' and 'guest' directives to control access to specific functionalities within the application.", 'Encouragement for Further Learning Encouragement is extended to the viewers to explore additional Laravel functionalities and resources, including the recommendation to watch more courses and refer to the Laravel documentation for deeper understanding.']}], 'duration': 1116.256, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MFh0Fd7BsjE/pics/MFh0Fd7BsjE7819445.jpg', 'highlights': ["Demonstrates using the 'has many through' relationship to access likes through posts", "Utilizing Laravel's relationship types", 'Covers integrating email functionality using Mail Trap for testing purposes', "Creating a mailable email class using Laravel's make mail command", 'Covers data display and relationship management', 'Creating an individual post page using a post controller and a show method', 'Implementation of Soft Deletes', 'Utilization of Middleware', 'Encouragement for Further Learning']}], 'highlights': ['The course covers authentication, Laravel Mix, controllers, eloquent relationships, authorization, sending email, validating forms, performance optimization, and more, providing an overview of as much as possible.', 'Setting up a Laravel project from scratch using the global composer installer', 'The migrations within the database folder migrate three tables by default, allowing the definition of the database schema.', 'The process of user registration and authentication in Laravel is made easier by using helper methods and facades, eliminating the need for complex code and manual injection of dependencies.', 'Middleware in Laravel modifies and prevents requests, applied to routes and controllers.', 'Creating a post controller, defining routes, rendering views, and creating a model and migration for a post in Laravel.', 'Demonstrating the use of factories to generate fake data for testing and seeding databases', 'Eager loading in Laravel reduces query count from 13 to 5, significantly improving query performance.', "Demonstrates using the 'has many through' relationship to access likes through posts", 'Covers integrating email functionality using Mail Trap for testing purposes', 'Creating an individual post page using a post controller and a show method', 'Implementation of Soft Deletes']}