Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,487 members, 7,958,480 topics. Date: Wednesday, 25 September 2024 at 03:18 PM |
Nairaland Forum / Science/Technology / Programming / Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE (5275 Views)
Any Laravel Developer Using Jetstream/livewire? / CSS Challenge: Post Any UI And I'll Replicate It In 30 Minutes. / Any Laravel Developer In The House? (2) (3) (4)
Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 2:24pm On Jun 09, 2021 |
Laravel PHP Devs in the house, Junior, Intermediate, Senior. Post any Laravel Code issues you are having, let's work on it together within 24 hours. Let's turn this thread to our own StackOverflow for Laravel issues. Please be as thorough as possible when posting your code issues. If possible, send steps on how we can replicate the problem All experts are welcomed to drop solutions as I might not always be online to respond to issues. 1 Like
|
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Karleb(m): 4:07pm On Jun 09, 2021 |
Oh boy! You are the tech bro I have been looking for. For a start, how do I create and use blade components inside a folder inside the components folder. As in, components > Post > store.blade.php How do I use that store.blade.php component in my view? |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Nickisindigo(m): 4:58pm On Jun 09, 2021 |
If you have PDF and videos on laravel plz share with me 1 Like |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Maj196(m): 5:04pm On Jun 09, 2021 |
Karleb:Just right click and create new file naming it (store.blade.php) inside the Post subfolder. Components > Post. To call the file from a controller for example. Just return it under the method like (return view (components.post.store). |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Karleb(m): 8:36pm On Jun 09, 2021 |
Maj196: What I specifically wanted was how to use components that is in a directory in the components folder. Components and not just any other view because it is reusable. Anyway I got my answer using the documentation. After creating it in a components > Post > store.blade.php, you'll do <x-Post.store /> to use it. Did you know today's Laravel 10th birthday? |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 12:01am On Jun 10, 2021 |
Karleb: Just saw your message. Once your component file is set up on your components folder in the resources > views folder, you can access it anywhere by doing <x-componentname/> If you have a folder inside the components folder, you can access it by <x-foldername.componentname/> |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 12:07am On Jun 10, 2021 |
@ mods: mukina2, lalasticlala, Mynd44 Can you guys pin this thread to the top of this programming section so that Laravel devs can find it faster. Laravel is one of the most popular framework for PHP in the world and this thread will bring together experts and newbies. Thank you. |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Maj196(m): 12:14am On Jun 10, 2021 |
Karleb:Oh, sorry I use Vue for the frontend mostly. Yes I know it's the 10th birthday. Awesome framework, yea? |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by promisedeco(m): 9:56am On Jun 10, 2021 |
Pls, I need a very comprehensive laravel video. Any recommendations |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 11:02am On Jun 10, 2021 |
promisedeco: Follow and Watch Laravel Daily on YouTube https://youtube.com/channel/UCTuplgOBi6tJIlesIboymGA 1 Like |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by promisedeco(m): 8:25pm On Jun 10, 2021 |
EWSTechSupport:Thanks boss |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Karleb(m): 8:45pm On Jun 10, 2021 |
Laravel Jetstream vs breeze, which do you use and why? |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by JFOD: 7:19pm On Jun 11, 2021 |
promisedeco: laracasts (some videos are not free tho). Laravel Daily (as suggested by someone) is also good. Non video The documentation is okay too 1 Like |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 7:19pm On Jun 11, 2021 |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Tribers: 10:17am On Jun 12, 2021 |
how can I add post view count in my laravel 8 I'm using breeze |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Karleb(m): 12:12pm On Jun 12, 2021 |
EWSTechSupport: Breeze or UI to avoid tailwind wahala. |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Karleb(m): 12:18pm On Jun 12, 2021 |
Tribers: There are packages to solve this but one simple way you can do this is increment the view_count column in the post table every time the page is opened or refreshed. Something like in the picture in your show method.
|
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 5:26am On Jun 13, 2021 |
Tribers: If you have a posts table, and you are looking at having detailed statistics about post views, you might need to setup a new table for post_views. Then reference the posts table id there. You may wish to track IP address of the viewer, and other information. Your question is a bit broad. If you need detailed help, I will point you to a video to watch |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Tribers: 6:37am On Jun 13, 2021 |
EWSTechSupport:I guess I will need the video |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 12:27am On Jun 14, 2021 |
Tribers: Sorry couldn't find the video I was looking for. Check my snippet below to understand Image 1 shows a simple migration table for blog posts Image 2 shows a simple migration table for blog post views Image 3 shows the blog post and blog post views relationship in the model (one to many) Image 4 shows the blog post views and blog post relationship in the inverse model (many to one) After u have setup your models and relationship, In your Blog Posts controller Show method you can store a new count record for the post_views table so that a new record is created each time the post is being viewed. To do that inside the show method we can say $new_view_count = new BlogPostView; $new_view_count->views = 1; $new_view_count->blog_post_id = $post_id; $new_view_count->save(); where $post_id is the id of the post in your show method
|
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 12:37am On Jun 14, 2021 |
There are packages on github that can help you achieve the same objective. One advantage of separating the views table from your posts table is you don't want to be updating the views column on the posts table each time your post is being viewed and also with a separate table you can log additional information like visitors ip, device, browser, etc EWSTechSupport: |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Tribers: 6:31am On Jun 14, 2021 |
EWSTechSupport:thanks for this |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Tribers: 8:34am On Jun 14, 2021 |
I need your whatsapp number |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 12:07pm On Jun 14, 2021 |
Tribers: 07081 307643 |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 3:52pm On Jun 16, 2021 |
Let's keep the thread alive. What's the proudest project you have done with Laravel? Share links. Your next client or employer might be looking at this thread! |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by JFOD: 4:55pm On Jun 16, 2021 |
Well ,I just started learning laravel. To keep the thread alive what do you think about posting small task, tips etc. I am currently working on a project (don't have na end goal, just adding features one by one). So far , I've added File upload (image , during registration) Login/Registration + Auth + Validation Delete button (yet to fully implement this , another user can delete someone else's profile ). I don't think that should be hard to fix I'll probably just make the delete button to only show when the owner is viewing the profile. I've paused it due to some other engagement and electricity issues. I was trying to implement the chat feature. Now, the issue I had How to display the chat of the message that was clicked. One can't do that with php/laravel (I stand to be corrected) I used JavaScript to detect which message was clicked. The problem I had/have is how to send the id of the message to the backend , so that I can retrieve the messages with the same sender and receiver id. I'm just few weeks old in laravel |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 8:31pm On Jun 16, 2021 |
Welcome to the thread. If I understood correctly, you have a list of various chat conversations and you want to be able to open each conversation and then read through it and chat further if you want. If it is this you want, you can achieve it with laravel,PHP. Each conversation has its own Id. Clicking that conversation will look for the id referenced in child tables holding the chat messages along with the sender and receiver ids. So basically in your show method, you can use the conversation id to get the chats in the chat table and then loop over them in the laravel blade front end. You can also use javascript if you are dynamically loading conversations in the frontend, then would need to send the id via a HTTP post or get call / axios in your javascript to the Laravel controller. You can research more how to do this JFOD: |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Tribers: 2:45pm On Jun 18, 2021 |
i have created category table now what I want to do is allow user to follow categories before they can see any topic under the category |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Karleb(m): 3:29pm On Jun 18, 2021 |
Tribers: First, you write a logic that hides/show the topics in each categories if user is following the said category. Secondly, you build a follow system. It's not so simple. |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by EWSTechSupport: 7:11pm On Jun 18, 2021 |
If you are not using Javascript or front end technology to do this, in Laravel php, you should have your categories table, users table and category_followers table where you include the user id and category id as foreign keys to help you track which user is following which category then you can use this to show or hide topics for logged in users based on their category followings Tribers: 1 Like |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Tribers: 10:12pm On Jun 21, 2021 |
How Can I Create 10 unique number for users when a user register I would like to create 10 unique numbers for them and it will be save in the database the user can use it to login next time |
Re: Laravel Nairaland Corner -- Post Any Laravel Code Issues, Get Solution For FREE by Karleb(m): 10:44pm On Jun 21, 2021 |
Tribers: There are many ways to generate those numbers. I will advice you edit the user migration file and add $table->bigInteger('unique_number'); Run php artisan migrate. If it doesn't run, do php artisan migrate:fresh. Note, with this command you'll lose data already in the database. Go to the method that registers the user in the controller and add $randomNo = Illuminate//Support/Facades/Str::random(10); Add the $randomNo to the array that registers the user. It should be something like App/Models/User::create($data). Do User::create(array_merge($data, ['unique_number' => $randomNo]). If you are using UI, it's easy to locate the RegisterController but if you are using Breeze or Jetstream, you might need to do a litte digging. With this, users should be able to generate random numbers after registration. Other alternatives are EventListeners, Observers.... Go to your login.blade.php and add a unique_integers input field to the existing email and password fields. The input type of the unique_integers should be integer and not text. Also, in the validation method, include the unique_integers field as required and unique:users. Something like, $data = request()->validate(/* email and password are already here */, 'unique_integers' => 'required|unique:users') ; After this, include the 'unique_users' data into the array inside the object methods that does the login. It should be something like, Auth::login($data) being changed to Auth::login(array_merge($data, ['unique_users' => $data['unique_users']); At this point, it should work. And if it doesn't, it should give you meaningful errors. I think I skipped some steps tho. Life was actually very simple before Laravel 8. |
My Board Games In Vb 6.0 / Runnable Java Atm Source Code Anybody,pls For Project, Very Urgent / Wrote My First HTML Page.
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 56 |