Hello,
Here is the quick solution:
$categoryId = ProductCategory::where('id',$id)->pluck('categoryId')[0];
$parentId = ProductCategory::where('id',$id)->pluck('parentId')[0];
print_r($categoryId);
print_r($parentId);
Plucking it array index 0 as the return from pluck is array based so indexing gives us the value for the particular column you need to pluck from table.
Hope this will give you an idea or solution to your problem.
Happy Learning, Happy Learning Laravel!
Break! I didn’t plan it. One day I just didn’t feel like opening Instagram—and then…
AI tools Let’s be real—AI sounds like either a robot apocalypse or something only tech…
Summer vacation is a great time for kids to explore, have fun, and learn new…
Goal: Understand transformers, large language models, and the architecture behind ChatGPT. Tutorial Suggestions: ✅ “Transformers…
Goal: Build apps or tools with ChatGPT or GPT-4 API. Tutorial Suggestions: ✅ OpenAI API…
Goal: Learn how to prompt better, write content, brainstorm, code, etc. Tutorial Suggestions: ✅ OpenAI's…