abhijeet9920

Web Developer at BDO LLP, India

Member Since 5 Years Ago

Mumbai

Experience Points
21,180
Total
Experience

3,820 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
172
Lessons
Completed
Best Reply Awards
5
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 5
21,180 XP
May
10
15 hours ago
Activity icon

Replied to Avoid Seq ID Duplication

I don't think it is a race condition. I have read what is race condition and how to tackle it.

Activity icon

Replied to Avoid Seq ID Duplication

Hello @narguelles,

Can you please tell how you're maintaining both table relationship? If you're storing just a unique column in another table, can't you just save the unique number to same table?

May
07
3 days ago
Activity icon

Replied to Original Model Translate

@davy_yg

Do you have table exists in database? Please check whether correct database settings are made in env file. Check whether table name is correctly passed.

May
04
6 days ago
Activity icon

Awarded Best Reply on How To Validate Date And Time?

Hello @crazylife ,

You can use custom validation rules.

Create a rule class, which takes date from request parameter as argument. Compare that date using Carbon\Carbon

<?php

namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Hash;

class Date implements Rule
{
    
    private $date;
    public function __construct($date)
    {
        $this->date = $date;
    }

    
    public function passes($attribute,$value)
    {
	    //build your logic;
    }

    public function message()
    {
        //your message;
    }
}

//called this 
$request->validator(['date' => ['required', new Date($request->date)]]);

Hope this helps

Activity icon

Replied to How To Validate Date And Time?

Hello @crazylife ,

You can use custom validation rules.

Create a rule class, which takes date from request parameter as argument. Compare that date using Carbon\Carbon

<?php

namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Hash;

class Date implements Rule
{
    
    private $date;
    public function __construct($date)
    {
        $this->date = $date;
    }

    
    public function passes($attribute,$value)
    {
	    //build your logic;
    }

    public function message()
    {
        //your message;
    }
}

//called this 
$request->validator(['date' => ['required', new Date($request->date)]]);

Hope this helps

Activity icon

Replied to Error While Installing A Package Through Composer

@linda maya ,

You're project has installed guzzlehttp/guzzle with version 7, but in composer.json for medilizer/selenium it is 6.2. You can change that composer.json with guzzlehttp/guzzle.

Activity icon

Awarded Best Reply on Protected Route

@johny-22 ,

I am not sure, but maybe you can check request type, whether it is HTTP or AJAX.

<?php
class Controller {
	public function index(Request $request){
		if($request->ajax()){
			return json;
		}
		//render exception
	}
}

Maybe this helps

Activity icon

Replied to Protected Route

@johny-22 ,

I am not sure, but maybe you can check request type, whether it is HTTP or AJAX.

<?php
class Controller {
	public function index(Request $request){
		if($request->ajax()){
			return json;
		}
		//render exception
	}
}

Maybe this helps

Apr
20
2 weeks ago
Activity icon

Commented on Assets, Layouts And Fancy Selects

Where is the repository?

Activity icon

Replied to How To Access Three Models And Get Data

You have to define missing relations in appropriate models

Apr
16
3 weeks ago
Activity icon

Replied to How To Combine Values Of Two Arrays Based On Quantity Value Into A Final Array

Ok. But how you're defining a price tier. Is it going to follow a mathematical pattern or something else?

Activity icon

Replied to How To Combine Values Of Two Arrays Based On Quantity Value Into A Final Array

@liammcarthur

I think what you're looking is

$array1 = get_price_tiers_by_product($variantPrice, $supplier);
$array2 = get_price_tiers_by_product($productPrice, $supplier);
$grouped  =  collect(array_merge($array1, $array2))->groupBy('qty')->map(function($value, $key){
	return ['qty'  =>  $key, 'price'  =>  collect($value)->sum('price')];
})->values()->all();
return  $grouped;

I've merged two arrays and performed groupedBy on key qty using laravel Illuminate\Support\Collection. Then called map function on it. Hope this works

Activity icon

Replied to Joining Paths Properly Using Laravel

@laracoft what exactly you're trying to do? It will be good if you give example

Activity icon

Replied to Order, Items And Products Relations

@metriakon

You need to create belongsToMany relationship in both orders and items tables.

<?php

class Order extends Model {

	public function products(){
		return $this->belongsToMany('App\Products', 'orders_items');
	}

}

Because you've defined many to many relationship, you have to mention pivot table in relationship which is orders_items in your case. I think this should work.

Apr
15
3 weeks ago
Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: PATCH.

If PATCH method need csrf token? No idea about this.

Activity icon

Replied to $fillable Question

@laracoft

Mass assignments means multiple insertion. You are inserting multiple rows using eloquent.

$fillable = ['name'];

fillable affects insert or create because

Model::create([
	['name' => 'John Doe'],
	['name' => 'Josh Doe']
])

Create can inserts one or many records at the same time. By default Laravel prevents multiple insertions unless until you've specified which columns can be inserted in bulk operations.

$model = new Model;
$model->name = 'Jane Doe';

This will insert one row at the time. $fillable variable will be ignored in this case.

Refer Mass Assignments

Activity icon

Replied to How To Get The Key Based On Values?

No problem buddy

Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: PATCH.

@rafaeladi You forgot to mention proper route action


<form method="POST" class="row g-1 {{$value->name}}" action="{{ route('update.case_details', ['id' => $value->id]) }}">
</form>

Assuming form will be PATCH instead of POST because of hidden variable _method

Activity icon

Replied to How To Get The Key Based On Values?

@romain

$array  = [
	'english'  => [
		'USA',
		'Canada',
		'Australia'
	],
	'spanish'=> [
		'Spain',
		'Venezuela'
	]
];

return  collect($array)->filter(function($value, $key){
	if(in_array('USA',  $value)){
		return  true;
	}
	return  false;
})->keys();

It may not be the best but it works. Use Collection filter

Activity icon

Replied to Being Stuck At The Same Page While Using Post Method In A Form

@linda please check your controller namespace. If you've declared form method as POST, then why your data is being sent in query parameters? Check your route list

Activity icon

Replied to String To Array In Laravel

You can pass data like this

{
	"data":[
		{"id":1000092},
		{"id":1000093}
	]
}

In the Postman -> Body tab, select Raw and set datatype as JSON. Decode this JSON into an array on server side.

Activity icon

Replied to String To Array In Laravel

Can't you pass this as JSON instead of an array?

Activity icon

Replied to String To Array In Laravel

How you are passing this? In query string or as POST?

Mar
04
2 months ago
Activity icon

Replied to Send Mail

May be this can help you.

Activity icon

Replied to Send Mail

Your user name must be @gmail.in na since you are using gmail smtp service?

Activity icon

Replied to Redirect->back() Issue

So in ajax you are returning redirect()->back()?

Activity icon

Replied to Redirect->back() Issue

Can you please share your pseudo code?

Activity icon

Replied to Send Mail

Hello @swapnilnandgave

I've read somewhere that for smtp drivers below code will work on local.

MAIL_DRIVER=smtp

For server you have to change name to sendmail

MAIL_DRIVER=sendmail

Maybe this work or try using 587 as port number.

Mar
01
2 months ago
Activity icon

Commented on Real-Time Facades

This post is three year old, I saw it today, and I'm glad that I saw today. I never knew this thing. Man you're great.

Feb
26
2 months ago
Activity icon

Replied to How To Automatically Add A Row Number

Hello @glitter grace

Since your array index are not integer, there is a not so good way of doing it. Split your index using explode and use the second item as row number like below

$products = ['product_1' => [
    'name' => 'Product 1',
],
'product_2' => [
    'name' => 'Product 2',
],
'product_3' => [
    'name' => 'Product 3',
]];
foreach($products as $index => $product){
    //Use your blade syntaxes here. Below is just for your references
    $row = explode('_', $index);
    echo "<td>".$row[1]."</td>";
    echo "<td>".$product['name'].</td>
}

Or you can use below also

$products = ['product_1' => [
    'name' => 'Product 1',
],
'product_2' => [
    'name' => 'Product 2',
],
'product_3' => [
    'name' => 'Product 3',
]];
$row_number = 0;
foreach($products as $index => $product){
    $row_number = $row_number+1;
    echo "<td>".$row_number."</td>";
    echo "<td>".$product['name']."</td>";
}
Feb
24
2 months ago
Activity icon

Replied to Laravel Excel Not Validating

@eludic , I'm not sure whether rules works with collection. Please try to validate your data before inserting. Please refer this

Activity icon

Replied to CURL Error 77: Error Setting Certificate Verify Locations

Try using .crt files and restart apache. I think this will work

Activity icon

Replied to Where Are You All From?

Hello from Mumbai , India :wave:

Feb
23
2 months ago
Activity icon

Replied to Help Creating Custom Count Blade Directive

I think the problem is in your variable initialization. Every time when you run directive, $occurences will be blank, hence 0 is returned. Even what you are trying to achieve is not clear.

Activity icon

Replied to Similar Question: Trying To Get Property 'p_name' Of Non-object

@tomasosho can you please post your relationship which you're using?

Seems users does not have any orders yet giving you an error. FindOrFail throws an exception, assumed that you've handled it already.