tisuchi

Sr. Software Engineer at CartX

Member Since 5 Years Ago

Dhaka, Bangladesh

Experience Points
728,815
Total
Experience

0 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
1747
Lessons
Completed
Best Reply Awards
660
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.

Level 50
728,815 XP
Oct
26
1 day ago
Activity icon

Replied to Pluck A Collection Relationship

@zuruck Make sure, your tags is an instance of the collection.

Oct
24
3 days ago
Activity icon

Awarded Best Reply on Form Validation Php Unit Testing

@mohammadbasir I am not sure, why you pass the value in the name field if you want to do validation testing.

I assure that you have validation testing in the controller. Then simply make the name filled null.

public function a_username_field_is_required_to_update_username()
    {
        $user = factory(User::class)->create();

        $updateData = [
            'name' => null,
        ];

        $this
            ->actingAs($user)
            ->post(route('settings.store.update.username'), $updateData)
            ->assertSessionHasErrors(('name'));
    }
Activity icon

Replied to Form Validation Php Unit Testing

@mohammadbasir I am not sure, why you pass the value in the name field if you want to do validation testing.

I assure that you have validation testing in the controller. Then simply make the name filled null.

public function a_username_field_is_required_to_update_username()
    {
        $user = factory(User::class)->create();

        $updateData = [
            'name' => null,
        ];

        $this
            ->actingAs($user)
            ->post(route('settings.store.update.username'), $updateData)
            ->assertSessionHasErrors(('name'));
    }
Activity icon

Replied to Statamic With Multiple Users And Solo Licence

@mrmooky although you have more than one user in DB to access it, however, centrally it will be used by one user. My point is there. I believe it will be fine as long as no issue has detected in your system.

Activity icon

Replied to Statamic With Multiple Users And Solo Licence

@mrmooky I just pick up your this line Only one user (me) should be able to maintain.. I am not sure about the Statamic licence, but if the case, then it shouldn't be an issue, that is my understanding.

Activity icon

Replied to Jetstream And User Controller

@alxxx Hey, if you are new in laravel, I believe you just go through with the basic courses of laravel. There, you will get some top-level idea on Laravel. Once you are done, you can focus on JetStream. This is my opinion.

BTW, jetstream is no required for laravel. It's a package like some other packages, i.g. passport, horzion and so on.

Oct
23
4 days ago
Activity icon

Awarded Best Reply on Looping On Array

@dikurr11 Use ` to wrap up your code so that it will be more readable.

Try this-

$records = [
		"a" => [
		 	0 => "2020-09-09" 
		 	1 => "2020-09-15" 
		] 
		"b" => [
			0 => "2020-09-13" 
			1 => "2020-09-17" 
			2 => "2020-09-20" 
			3 => "2020-09-21" 
			4 => "2020-09-22" 
			5 => "2020-09-23" 
			6 => "2020-09-24" 
			7 => "2020-09-25" 
			8 => "2020-09-26" 
			9 => "2020-09-27"
		] 
		"c" => [
			0 => "2020-09-11" 
			1 => "2020-09-12" 
			2 => "2020-09-09" 
			3 => "2020-09-02"
			4 => "2020-09-03" 
			5 => "2020-09-26"
		] 
		"d" => [
			0 => "2020-09-16" 
			1 => "2020-09-09"
		] 
		"e" => [
		 	0 => "2020-09-11" 
		 	1 => "2020-09-12" 
		 	2 => "2020-09-13" 
		 	3 => "2020-09-25" 
		 	4 => "2020-09-26" 
		 	5 => "2020-09-22" 
		 	6 => "2020-09-23"
		]
	];

foreach($records as $record){
	// From here you can access A to E array key. It will return you an array actually. 
	/*
		i.e.   
	 	[
		 	0 => "2020-09-09" 
		 	1 => "2020-09-15" 
		]
	*/		 

	// If you need to access deeper node, then, try this-
	foreach($record as $innerNode){
		// Here you can access 0, 1, 2, etc level
		// i.e. "2020-09-09" 
	}
}
Activity icon

Replied to Strange Behavior Author Role

@theblack68 unfortunately, this is not the right forum, unless someone answers you willingly.

You better use it- https://wordpress.org/support/forums/

Oct
21
6 days ago
Activity icon

Replied to How Do We Match Token From Web And Mobile Apps For Authentication?

@crazylife what if you simply use laravel passport for that? Doesn't it help you?

Oct
20
1 week ago
Activity icon

Replied to Laravel Very Slow

@mohamedkhalid You go download 3.40 version.

Ref: https://packagist.org/packages/barryvdh/laravel-debugbar#3.4.x-dev

Now run-

composer require barryvdh/laravel-debugbar:~3.4
Oct
19
1 week ago
Activity icon

Replied to Avoid Chineese Language Spam Threads

@deekshith in my opinion, limiting two threads in an hour is not a wise idea. A legit user can have the possibility to post more than two times hourly.

Oct
18
1 week ago
Activity icon

Replied to Looping On Array

@dikurr11 Use ` to wrap up your code so that it will be more readable.

Try this-

$records = [
		"a" => [
		 	0 => "2020-09-09" 
		 	1 => "2020-09-15" 
		] 
		"b" => [
			0 => "2020-09-13" 
			1 => "2020-09-17" 
			2 => "2020-09-20" 
			3 => "2020-09-21" 
			4 => "2020-09-22" 
			5 => "2020-09-23" 
			6 => "2020-09-24" 
			7 => "2020-09-25" 
			8 => "2020-09-26" 
			9 => "2020-09-27"
		] 
		"c" => [
			0 => "2020-09-11" 
			1 => "2020-09-12" 
			2 => "2020-09-09" 
			3 => "2020-09-02"
			4 => "2020-09-03" 
			5 => "2020-09-26"
		] 
		"d" => [
			0 => "2020-09-16" 
			1 => "2020-09-09"
		] 
		"e" => [
		 	0 => "2020-09-11" 
		 	1 => "2020-09-12" 
		 	2 => "2020-09-13" 
		 	3 => "2020-09-25" 
		 	4 => "2020-09-26" 
		 	5 => "2020-09-22" 
		 	6 => "2020-09-23"
		]
	];

foreach($records as $record){
	// From here you can access A to E array key. It will return you an array actually. 
	/*
		i.e.   
	 	[
		 	0 => "2020-09-09" 
		 	1 => "2020-09-15" 
		]
	*/		 

	// If you need to access deeper node, then, try this-
	foreach($record as $innerNode){
		// Here you can access 0, 1, 2, etc level
		// i.e. "2020-09-09" 
	}
}
Activity icon

Replied to Avoid Chineese Language Spam Threads

@deekshith Yes, it could be another option if you are sure that none of your legit users use Chinese alphabet.

Activity icon

Replied to Avoid Chineese Language Spam Threads

@deekshith First of all, if the user does it manually, it proves that he is a legit user. In that case, you can do a few possible things-

  • Keep manually ban user that's what you are doing now.
  • Track that particular user IP and ban that IP (if applicable).
  • Apply Report Spam Option in every forum post as like as Laracasts so that anyone can report about any inappropriate post.
Activity icon

Replied to How To Count Post Of User?

@balamurugan08

You can simply use relationship on it. I assume that, user and voucherdetails tables have a one to may relationship.

In User.php model-

public function voucherdetails(){
	return $this->hasMany(Voucherdetails::class);
		// I assume the foreign key is user_id
}

In Voucherdetails.php model-

public function user(){
	return $this->belongsTo(User::class);
}

Now from the controller, you can easily call count on the relationship.

User::withCount('voucherdetails')
	->where('id', 1)
	->first();

This query will be fetching user data where id is 1 with counting voucherdetails records.

Oct
11
2 weeks ago
Activity icon

Replied to How To Use Casts With Json Columns?

@jewishmoses isn't that the similar one that you are looking for?

btw, if it doesn't help you then you can try with Array and JSON Casting.

if your database has a JSON or TEXT field type that contains serialized JSON, adding the array cast to that attribute will automatically deserialize the attribute to a PHP array when you access it on your Eloquent model

https://laravel.com/docs/8.x/eloquent-mutators#array-and-json-casting

Oct
10
2 weeks ago
Activity icon

Awarded Best Reply on Render Paypal Button Once Only

@mohammadbasir if I understand you properly, then you can use flag for click count.

That's what I can think of now.

let clicked = 0;

function payPalCheckout(){
	// Rednder paypal button once only, even
    // user intentionally clicked few times.
    if (clicked == 0){
    	loadPayPalButton();
    	clicked++;
    }
}

function loadPayPalButton(){
    // Load Paypal button code.
}
Activity icon

Replied to How To Get Last Day Of A Month?

@vincentmimounprat99

To achieve your goal, you need to change your code as follows-

Scholarship::where('expired_at', '>', now()->endOfMonth())
	->orderBy('count', 'desc')
	->take(10)
	->get();
Activity icon

Awarded Best Reply on How To Get Last Day Of A Month?

@vincentmimounprat99

There are many ways to do that. Since you are using Laravel, you can easily use ->endOfMonth() of Carbon for that.

For example

now()->endOfMonth()

It will return you the last day of the current month.

Activity icon

Replied to How To Get Last Day Of A Month?

@vincentmimounprat99

There are many ways to do that. Since you are using Laravel, you can easily use ->endOfMonth() of Carbon for that.

For example

now()->endOfMonth()

It will return you the last day of the current month.

Oct
09
2 weeks ago
Activity icon

Replied to Laravel One To One - Delete Old Record On Creating New One

@midhunmonachan

I haven't tested the code, but I believe it should work.

public function refreshOtp() {
    $this->update([
    	'otp' => substr(md5(microtime()), 0, 6);
   	]);
}

It will just update the existing code.

Activity icon

Awarded Best Reply on Verification.resend Page Returns Page Expired

@midhunmonachan

The general rules, as long as you are submitting the post method, ofcourse you need to pass csrf token.

Just simply pass @csrf in the form.

<form action="{{route('verification.resend')}}" method="post">
	@csrf
     <button id="resend" type="submit">{{ __('Resend') }}</button>
</form>
Activity icon

Replied to Verification.resend Page Returns Page Expired

@midhunmonachan

The general rules, as long as you are submitting the post method, ofcourse you need to pass csrf token.

Just simply pass @csrf in the form.

<form action="{{route('verification.resend')}}" method="post">
	@csrf
     <button id="resend" type="submit">{{ __('Resend') }}</button>
</form>
Activity icon

Replied to Render Paypal Button Once Only

@mohammadbasir if I understand you properly, then you can use flag for click count.

That's what I can think of now.

let clicked = 0;

function payPalCheckout(){
	// Rednder paypal button once only, even
    // user intentionally clicked few times.
    if (clicked == 0){
    	loadPayPalButton();
    	clicked++;
    }
}

function loadPayPalButton(){
    // Load Paypal button code.
}
Activity icon

Awarded Best Reply on (ErrorException(code: 0): Non-static Method

@a4family

I think it's because of you are calling paymentGatewayKey() method inside the static method statically but you haven't declared it as static.

It should work if you change paymentGatewayKey() method like this-

public static function paymentGatewayKey()
    {
        return PaymentGatewaysKey::where('shop_id', request()->shop->id)
            ->where('gateway_type', PaymentGatewaysKey::GATEWAY_TYPE_PAYPAL)
            ->first();
    }
Activity icon

Replied to (ErrorException(code: 0): Non-static Method

@a4family

I think it's because of you are calling paymentGatewayKey() method inside the static method statically but you haven't declared it as static.

It should work if you change paymentGatewayKey() method like this-

public static function paymentGatewayKey()
    {
        return PaymentGatewaysKey::where('shop_id', request()->shop->id)
            ->where('gateway_type', PaymentGatewaysKey::GATEWAY_TYPE_PAYPAL)
            ->first();
    }
Activity icon

Replied to (ErrorException(code: 0): Non-static Method

@a4family

Can you show PayPalRepository code?

Activity icon

Replied to How To Pass Holiday Dates From Controller In View In Laravel Using JSON

@noblemfd

I think it's because of holiday_date column is not date-time cast.

What if you add following code in HrHolidate model and then try?

protected $casts = [
    'holiday_date',
];

It will make holiday_date column as carbon instance.

Activity icon

Replied to How To Create Tabel?

@oxbir What do you mean by getting the error when saving? Show your saving code?

Oct
06
3 weeks ago
Activity icon

Awarded Best Reply on Lumen With Sso Applications

@sakthivel

I am not sure which version of lumen you are using now. However, I believe the following resource can help you to figure it out-

Oct
05
3 weeks ago
Activity icon

Awarded Best Reply on SQLSTATE[HY000] [1045] Access Denied For User 'user'@'localhost' (using Password: YES) (SQL: Select * From `users` Where `email` = [email protected] And `users`.`deleted_at` Is Null Order By `updated_at` Desc Limit 1)

@joecakacaka

It should be like that-

DB_CONNECTION=mysql

DB_HOST=localhost

DB_PORT=3306

DB_DATABASE=thegrhx7_secureloanswcu

DB_USERNAME=thegrhx7_kevin

DB_PASSWORD=Password for the thegrhx7_kevin user
Activity icon

Replied to Socialite Issue

@jleitch

If this is the case, what if you set the default value of OKTA_BASE_URL like that way?

'base_url' => env('OKTA_BASE_URL', 'dev-12345.okta.com')

And plz clear your cache and config.

Activity icon

Awarded Best Reply on How To Print The Current Version Of Laravel

@papia91

The following code will print your current version of your application.

{{ app()->version() }}

Or you can try this way also-

{{ App::VERSION() }} 
Activity icon

Replied to How To Print The Current Version Of Laravel

@papia91

The following code will print your current version of your application.

{{ app()->version() }}

Or you can try this way also-

{{ App::VERSION() }} 
Activity icon

Replied to SQLSTATE[HY000] [1045] Access Denied For User 'user'@'localhost' (using Password: YES) (SQL: Select * From `users` Where `email` = [email protected] And `users`.`deleted_at` Is Null Order By `updated_at` Desc Limit 1)

@joecakacaka

It should be like that-

DB_CONNECTION=mysql

DB_HOST=localhost

DB_PORT=3306

DB_DATABASE=thegrhx7_secureloanswcu

DB_USERNAME=thegrhx7_kevin

DB_PASSWORD=Password for the thegrhx7_kevin user
Activity icon

Awarded Best Reply on Laravel PayPal Direct Payment Issue.

@myszon

You can use parse_str for that.

$paymentData = GettingResponseFromPayPal;

// Converting PayPal response to Array
$responseArray = array();

parse_str($paymentData, $responseArray); // Break the NVP string to an array

dd($responseArray);
Activity icon

Replied to SQLSTATE[HY000] [1045] Access Denied For User 'user'@'localhost' (using Password: YES) (SQL: Select * From `users` Where `email` = [email protected] And `users`.`deleted_at` Is Null Order By `updated_at` Desc Limit 1)

@joecakacaka exactly.

If the file is not there, then you can just copy from .env.example file and create a new file with the name of .env. Then change the variable as I explained earlier.

Activity icon

Replied to Laravel PayPal Direct Payment Issue.

@myszon

You can use parse_str for that.

$paymentData = GettingResponseFromPayPal;

// Converting PayPal response to Array
$responseArray = array();

parse_str($paymentData, $responseArray); // Break the NVP string to an array

dd($responseArray);
Activity icon

Replied to SQLSTATE[HY000] [1045] Access Denied For User 'user'@'localhost' (using Password: YES) (SQL: Select * From `users` Where `email` = [email protected] And `users`.`deleted_at` Is Null Order By `updated_at` Desc Limit 1)

@joecakacaka go to the project root directory, then you will file .env file. Open it and change the database section.

Sample code will be like that-

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database
DB_USERNAME=root
DB_PASSWORD=

Typically you need to change DB_DATABASE, DB_USERNAME, and DB_PASSWORD fields.

Oct
04
3 weeks ago
Activity icon

Replied to Laravel 8.x 419 "CSRF Token Mismatch"

@pn Have you checked in the source code in HTML, what exactly you are getting once you prince it?

<meta name="csrf-token" content="<?php echo csrf_token(); ?>
Activity icon

Replied to Laravel 8.x 419 "CSRF Token Mismatch"

@pn Alternatively you can pass token in the header-

$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});

Check more: https://laravel.com/docs/8.x/csrf#csrf-x-csrf-token

Activity icon

Replied to Object Of Class App\SocialNetwork Could Not Be Converted To Int

@oxbir

I think it should be $socialNetwork->social_id.

{{ ($socialNetwork->social_id == $social->id) ? 'selected': ''}}
Activity icon

Replied to Creating API Using Laravel

@laracoft haha...

I totally missed you guys discussion. Thanks, man.

@proelitesunny if you are still available, you better mark it solve at least. :)