i used from this structure for save categories in database +———+———–+———–+ | id | name | parent_id | +———+———–+———–+ | 1 | Supports | 0 | | 2 | Mobile | 0 | | 3 | Outdoor | 1 | | 4 | Samsung | 2 | | 5 | Cricket | 3 | | ..
Category : refactoring
Need help to refactor this code to look like its done by a pro. The idea is to clone a div with two empty tables for two separate arrays of data. div is cloned depending on the longest array length between the two. <div id="d-page-0"> <table id="e-tbl-0"> //content1 //6 col, 7 rows </table> <table id="w-tbl-0"> ..
I’m using some hard coded statuses in my app to track the status of an order. For an example 1 – draft 2 – placed 3 – completed Currently I’m keeping them in a database table as order statuses. In the app level I’m using these status to validate the order updates. Such as If ..
My project previously worked with Laravel Auth out of the box. There was a request to switch to oauth2 authenticiation (so I retrieve login data with a token and handle getting a code, then using that code to get user information and log the user in). So i reworked the LoginController to use https://oauth2-client.thephpleague.com/usage/ The ..
I use this custom class code to handle different types of orders in Laravel. This question includes the code regarding Order Type A. I want to know how to reuse the code with object creation. Because I see lot of repetition in code. I have different Order Types with the same functions but different in ..
I’m creating a like feature for my application where users can like posts, events, products etc. I have a LikeController and a Trait which handles the like functionality public function store(Post $post) { $post->like(); return back(); } The code above is to like a post I don’t want to duplicate code and create separate functions ..