
Create an instagram clone project folder, install a Laravel 10 app with composer, open the folder in your editor, and verify the setup by running PHP artisan serve.
Install Breeze
Add env credentials
Migrate database
npm run dev
Create user
Change the redirect link in RouteServiceProvider
Install Livewire
Publish livewire config and update 'layout' => 'layouts.app',
Install livewire hot reload from https://christoph-rumpel.com/2022/7/auto-refresh-livewire-components-while-keeping-states-with-vite
Install Daisy UI via NPM
require Daisy Ui in tailwind config,
add themes to light
Go to Daisy ui and get Layout Drawer code
Update layout in 'layouts.app'
Add x-cloak to style
We do this to save time from searching for special icons on various websites and repeating same process
Download Avatar , paste it in components folder
Download logo,Create public folder assets and paste logo
Download Sidebar , paste it in layouts folder
php artisan make:livewire home
Create auth route group and add '/' url , remove default '/' url
Install scrollbar hide package
https://github.com/reslear/tailwind-scrollbar-hide
Design the instagram-like right sidebar with a profile and suggestions list, hide the scrollbar using tailwind scroll bar hide, and include avatars, follow button, and links section.
Design a mobile header and responsive top navigation that mirrors Instagram, featuring a logo, search input, and heart icon, with sticky top layout and dynamic suggestions list.
Create post item
Add post item to home
Create Header
design header with avatar and dots on the right
Video
Create custom x-video component
Add props source
add x-video to item component
Add icons
Add content
add form
Install swiper.js via npm
Copy swiper template
Initialise swiper.js in alpine x-init
run the command php artisan make:model Post -mfs
Add fields to table
Add casts and properties and relationships to Model class
Add posts relationship to User model
Add factory
use this link for testing videos 'https://gist.github.com/jsturgis/3b19447b304616f18657'
run the command php artisan make:model Post -mfs
Add fields to table
Add casts and properties and relationships to Model class
Add factory
get public test vidoes -(search query) public test videos Github
get photos urls from unsplash
refresh database and seed
query posts in mount method
loop through posts in blade take a few in the beginning
pass post model to item component
add dynamic relevant fields
Only swiper nivigation if post->media count is greater that 1
Install Wire modals package
Make component : php artisan make:livewire post.create
Add button to open create post component in drawer(sidebar)
Add Safelist to Tailwind config.js
Add purge to Tailwind config.js
Add modalMaxWidth() method
Design Header and let side
This lecture designs the right side of the create post UI, pairing avatar and name with a caption area, location input, and advanced toggles for likes, views, and commenting.
Download testing vidoes from https://pixabay.com/videos/
Download testing pictures from https://unsplash.com/
Add properties to component
Create submit method and add dd()
Add disabled attr to submit button
add wire models to inputs
submit and test dd()
Add preview to media Dont forget to replace hidden with flex class
Add .mp4 to accepted files in input
add default as false for the following
public $hide_like_view=false;
public $allow_commenting=false;
Add validation for media
Add Temporary url validation in Livewire config Note: validating temp file in component will not work
If neccessary edit the php.ini file to increate the max_uplodad_size
when saving the file to disk
make sure disk is public
!!!!! run command php artisan storage:link to access the file from /storage/media/...
After creating post , go and change order type in home to latest()->get(); in order to view post
Create inline modal component php artisan make:livewire post.view.modal --inline
Extend modal component
Add properties and methods
get url and push state
Add closeModal listener in home component
Publish wire-elements views php artisan vendor:publish --tag=wire-elements-modal-views
Add custom onclick="Livewire.dispatch('closeModal')" To overlay this will also dispatch closeModal so we can listin in home component
php artisan make:livewire post.view.item
add <livewire:post.view.item :post="$this->post" /> to modal
Create item view layout ,
Use css snap scroll , and show files
Copy header from post item
copy footer from post item -add (mt-auto)
run php artisan make:model Comment -mfs
Add fields to table
Add methods/relationship to Comment model
Add relationships to Post model
run php artisan migrate
Comments
Add fields to comments factory
Add ->hasComments(rand(20,50)) to post factory in DatabaseSeeder
refresh database and seed (!!!!important add prepend time() to users email in UserSeeder to avoid duplicate entry errors )
Go to home filter by ->whereHas('comments') to see post with comments and dd($posts->first())
In the post >item add $post->comments->count()
revert the changed in home and add ->with('comments')
Replies
add state function called isReply() to CommentFactory to create comments as replies
add the factory to the Database seeder
refresh database
View the replies in home by dd()
Remove $posts as public variable
Add required vairables
add scroll detection event
load posts as $perPage in render()
remove the take(50) from blade loop component
Design comments
Add $post->user->name just for testing
Load comments in render();
Replace $post->user->name with $comment->user->name
In the home make sure you add ->latest(); in order to see posts with comments
Add replies
Create partials folder post.view.partials
Create comment.bladel.php file in partials folder
Create reply.blade.php file in partials folder (add subreplies to reply.blade.php)
Add ->whereDoesntHave('parent') in View.Item Livewire componentn
Update code in DatabaseSeeder in order to test sub replies
Create addComment method
Create $body property , change inputText to body
In the form submit button add type="submit"
Add @submit.prevent="$wire.addComment()" in the Form . test it !! with dd()
Add entangled $body and $parent_id
Submit Form and create comment
Add wire:key="{{time()}}" to Form
Remove space between @ and username
Add wire:click="setParent({{$reply->id}})" to reply button in sub comment
add setParent method and inject Comment model
Add wire:click="setParent({{$comment->id}})" to comment reply button
remove the {{'@'.$reply->parent->user->name}} from reply body
Add body property
Copy addComment() method from post.view.item to post.item component
remove parent_id
rename inputText to body in post.item <form>
make body entangled
add type submit to Button in <form>
add wire:key="{{time()}}" to <form>
Show user's comments on Post Item
Only how <form>, <trigger button> and auth comments if commenting_is_allowed in POST.ITEM
Also hide all comments and <form> in POST.VIEW.ITEM
Change button title to "Allow Commenting" in Create Item component
Embark on an exciting coding journey with our immersive course as we unravel the magic of web development together. Picture this: we'll be diving deep into the key features on the Home Page – from the seamless Swipe and Like functionalities to the engaging Stories and the dynamics of Follow/Unfollow. Get ready to immerse yourself in user interaction as we explore Commenting, Saving posts, and effortlessly scrolling through the Home Feed.
But wait, there's more! We'll navigate the vast possibilities of Search Functionality, making it easy to connect with users by finding, exploring profiles, and initiating follows. Brace yourself as we step into the Explore Page, unveiling Hover Functionality and diving into interactive engagement with posts and comments.
Hold on tight as we experience the dynamic Reel Page – play, like, save, and take a smooth ride through captivating reels. We won't stop there; we'll delve into real-time user interaction with Messages and Notifications, creating an immersive social experience that goes beyond the ordinary.
And guess what? That's just the beginning of our adventure! Learn to craft stunning posts, incorporating Mixed media posts while considering file size. Explore your profile with tabs for a comprehensive overview of your digital presence.
This is more than a course; it's a personalized journey into the heart of web development, where we don't just learn – we actively build and refine our skills together