tisuchi

Sr. Software Engineer at Avana.asia

Member Since 5 Years Ago

Dhaka, Bangladesh

Experience Points
678,245
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
1580
Lessons
Completed
Best Reply Awards
624
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
678,245 XP
Apr
05
2 days ago
Activity icon

Awarded Best Reply on How To Format Date In Unique Rules

@noblemfd

Have you thought this way to implement?

Carbon\Carbon::parse($this->start_date)->format('Y-m-d')
'goal_type_id' => [
    'required', 
	Rule::unique('appraisal_goals')->where(function ($query) {
	return $query->where('appraisal_identity_id', $this->appraisal_identity_id)
		->where('goal_type_id', $this->goal_type_id)
		->where('start_date', Carbon\Carbon::parse($this->start_date)->format('Y-m-d'));
	})               
],
Activity icon

Replied to Array_key_exists(): Using Array_key_exists() On Objects Is Deprecated In Laravel 6 With PHP 7.4

@surajwillrock

It's because array_key_exists() is deprecated in PHP 7.4. It's not issue with Laravel, it's because of you are using PHP 7.4 version (I guess), that's why getting this error.

https://www.php.net/manual/en/migration74.deprecated.php

Activity icon

Replied to Laravel Passport API, Method Attempt Does Not Exist.

@andy0517

How is your route file? Can you show?

Activity icon

Replied to How To Format Date In Unique Rules

@noblemfd

Have you thought this way to implement?

Carbon\Carbon::parse($this->start_date)->format('Y-m-d')
'goal_type_id' => [
    'required', 
	Rule::unique('appraisal_goals')->where(function ($query) {
	return $query->where('appraisal_identity_id', $this->appraisal_identity_id)
		->where('goal_type_id', $this->goal_type_id)
		->where('start_date', Carbon\Carbon::parse($this->start_date)->format('Y-m-d'));
	})               
],
Activity icon

Replied to Route Model Binding With Resource Routes?

@tuffrivers

First of all, shouldn't it be resource instead of Route::resources([?

You get your answer there-

https://stackoverflow.com/questions/24397660/can-route-model-binding-be-used-with-restful-controllers

Apr
02
5 days ago
Activity icon

Replied to Error: Call To A Member Function Increment() On Null

@siewlon6093

Is that work?

static::created(function ($like){
    $like->creator()->increment('reputation', 10);
});
Apr
01
6 days ago
Activity icon

Awarded Best Reply on Two Dependencies

@bladerunner well, imagine that you have a UserRepository that needs in user() method only. In that case, I suggest you follow this way-

class TopicController extends Controller
{
	protected $topics;

    public function __construct(TopicRepository $topics)
    {
    	$this->topics = $topics;
    }

    public function user(){
    	$getUsers = (new UserRepository())->get();

    	// Write your logic here. 
    }
}

In this way in the user() method, you can call any methods from UserRepository(). That's what I can think of right now.

Activity icon

Replied to Two Dependencies

@bladerunner well, imagine that you have a UserRepository that needs in user() method only. In that case, I suggest you follow this way-

class TopicController extends Controller
{
	protected $topics;

    public function __construct(TopicRepository $topics)
    {
    	$this->topics = $topics;
    }

    public function user(){
    	$getUsers = (new UserRepository())->get();

    	// Write your logic here. 
    }
}

In this way in the user() method, you can call any methods from UserRepository(). That's what I can think of right now.

Activity icon

Replied to Two Dependencies

@bladerunner ideally there is no issue to inject more than 1 repositories. Again it depends on your business logic. If your company decides that, you should not inject more than 1 class, then it's a different scenario.

But don't forget my concern-

The only concern is if you have other methods in TopicController that don't require both of the Repositories, that time it might be a waste of calling extra repositories without using it.

Activity icon

Replied to Two Dependencies

@bladerunner I cannot see any issue here. Why you are thinking about it?

The only concern is if you have other methods in TopicController that don't require both of the Repositories, that time it might be a waste of calling extra repositories without using it.

Mar
31
1 week ago
Activity icon

Replied to Trying To Get Property 'likes' Of Non-object (View: /app/resources/views/products/productView.blade.php)

@asadsajjad

You better wrap your code with 3 ` so that it will be more readable.

Activity icon

Replied to Php Artisan Migrate:refresh Error

@siewlon6093 what if you run these commands?

composer clear-cache
php artisan migrate
Activity icon

Replied to Php Artisan Migrate:refresh Error

@siewlon6093 it seems the cache issue.

You can run php artisan and composer to get the available list of commands.

However, I can suggest running these following commands to remove cache-

composer clearcache
php artisan cache:clear
Activity icon

Replied to Php Artisan Migrate:refresh Error

@siewlon6093 What do you mean by done all the step?

I simply prefer if you don't have any important data in your tables, then delete all the tables from your database.

Then just run php artisan migrate command.

If you have still issue, don't forget to run the following commands that @siewlon6093 suggested...

composer dump-autoload
php artisan migrate
Activity icon

Replied to Php Artisan Migrate:refresh Error

@siewlon6093 There are two ways to fix that.

  1. Delete all tables and run php artisan migrate

  2. Delete admin_settings related row from the migrations table and run php artisan migrate:refresh.

Hope it will work.

Mar
30
1 week ago
Activity icon

Replied to The Best Way To Make Custom HTML Validation Errors In Wordpress ?

emmm... It might not be the right place. However, if anyone answers on your issue.

Activity icon

Replied to A Threat Is Showing Without Title And Description

Are you able to see anything?

Activity icon

Started a new Conversation A Threat Is Showing Without Title And Description

Hey @jeffreyway

It's strange behavior that I can able to see a threat on Laracast without displaying the title and description. In that in only my side?

https://laracasts.com/discuss/channels/laravel/lets-build-a-forum-tut-problem-in-assertsee

Activity icon

Replied to System: Mac Catalina Update, Problem: TokenMismatchException

@dragonberr Have you checked with the incognito window?

Then you can try with the following commands too-

php artisan cache:clear
php artisan config:clear
Activity icon

Replied to API Authentication Via Social Networks For Your Laravel Application

@princeoo7

Here you need to provide the credentials from your social application.

'google' => [
    'client_id' => env('GOOGLE_CLIENT_ID'),
    'client_secret' => env('GOOGLE_CLIENT_SECRET'),
    'redirect' => env('GOOGLE_REDIRECT_URL'),
],

For example, GOOGLE_CLIENT_ID should be replaced by the real google client id.

Make sure you have placed the right id, secret and redirect path.

Mar
25
1 week ago
Activity icon

Replied to Laravel Getting Data From Two Tables

@rjonwal

Can you show more of your error in which line or file you are getting the error?

Mar
23
2 weeks ago
Activity icon

Replied to Database User Grant Privileges

@tarikali In that case, you need to provide full access to the user.

Activity icon

Replied to Database User Grant Privileges

@tarikali

It actually depends on what kinds of operation you want to allow the user. If the read only is good enough for the user, then there is no point to provide the rest of the accessibility to the user.

Mar
20
2 weeks ago
Activity icon

Replied to Two Record At Once In Database

@genjosanzo What kind of session you are using? What is the purpose of using the session?

Mar
18
2 weeks ago
Activity icon

Awarded Best Reply on Laravel Admin Panel

@karolgil Beside @sergiu17 suggestion, I recommend checking this list too-

https://www.dunebook.com/best-laravel-admin-panel/

Activity icon

Replied to Two Record At Once In Database

@genjosanzo

The concept can be-

$account = Account::create([
	// Add you data here;
	// If token can be empty, just make it empty, otherwise, set 1 for timebeing. 
]);

$token = Token::create([
	// add token data. 
	'account_id' => $account->id
]);

// Now update account with token. 
$account->update([
	'token' => $token->token
]);

In that case, make sure you allow the fillable property in the model.

Activity icon

Awarded Best Reply on Convert Month Name To Number With Carbon

Try this @tatthien

Carbon\Carbon::parse('1 April')->month
Activity icon

Replied to Globally Install Specific Version Of Laravel

@chron

What if you install the latest version of Laravel globally first, then during installation, use this way?

laravel new blog --version

// laravel new blog --5.8
Activity icon

Replied to Retrieve Data Based On Specific Date

@fareedr I prefer here to follow this convention-

  • Use provide starting and ending month-year to fetch data.

For example- As a user, I want to fetch data from January 2020 to February 2020. Then behind the scene, you need to calculate-

  • The starting day of the given starting month. It will be like this 2020-01-01.
  • The ending day of the given ending month. It will be like this 2020-02-29.

Now, you just apply the query like this way-

...
...
->whereBetween('updated_at', [$from, $to])
...
Activity icon

Replied to Retrieve Data Based On Specific Date

@fareedr

Can you try this?

$deal = Deal::whereHas('post',function ($q) use ($seller_id){
		$q->where('user_id',$seller_id);
	})
	->whereMonth('updated_at',$month)
	->where(function($q){
		$q->where('status','Received')
			->orWhere('status','Completed');
	})
	->get();
Activity icon

Replied to How To Use Tinker For Testing Purpose

@shan2590

I see.

There might be a way to do that, but honestly, I never heard to write test in that way... !!!

Activity icon

Replied to How To Use Tinker For Testing Purpose

@shan2590

If you want to use tinker in general-purpose, doesn't factory help you to achieve that?

Activity icon

Replied to Auth::login Not Working After A Redirect

@turnerd do you get any error?

Activity icon

Replied to Laravel Blade

@rully if @nakov answer helped you, mark it the best answer plz.

Activity icon

Replied to Auth::login Not Working After A Redirect

@turnerd

If it doesn't work, I believe somewhere it conflict with $user variable. I just change the name of the variable a bit. Can you try with the following code?

BTW, are you getting any error with this code?

public function success(Request $request){ 

	// Above makes API calls, all of which work 
	$userJson = json_decode($user->getBody()); 
	$userObj = User::find($userJson->id);

    if(!$userObj){
        $newUser = new User([
            'id' => $userJson->id,
            'username' => $userJson->username,
            'email' => $userJson->email,
            'access_token' => $token->access_token,
        ]);
        $newUser->save();
    }else{
        $userObj->access_token = $token->access_token;
        $userObj->save();
        $newUser = $userObj;
    }

    Auth::login($newUser);

    return redirect()->route('dash.index');
}
Activity icon

Replied to Auth::login Not Working After A Redirect

@turnerd Can you show your full method and tell what exactly you want to achieve?

Activity icon

Replied to Auth::login Not Working After A Redirect

@turnerd

What is returning the Auth::login()? Make sure that you are passing a User object via $user.

Mar
15
3 weeks ago
Activity icon

Replied to Laravel 7 Cors Fails To Clear Cached

@daxsis although my link is a bit outdated, however, I think it will help you to figure it out besides @tray2 suggestion-

https://github.com/laravel/framework/issues/25451

Mar
11
3 weeks ago
Activity icon

Replied to Post Detail Page Is Not Indexed In Google But Post List Page Is Indexed

@ziaakbari I meant the priority is the level of depth of your url.

Here- /posts has the url depth 1 /posts/slug has the url depth 2

That's what I mean.

So, the easiest way, you just add your site in the google webmaster tool then do the following things-

  • Add and verify your site
  • Add sitemap to the google webmaster tool.
  • Fetch post to google webmaster tool as google bot.

I hope by doing that, it will fix your issue.

Mar
10
4 weeks ago
Activity icon

Replied to Post Detail Page Is Not Indexed In Google But Post List Page Is Indexed

@ziaakbari

It could have many reasons. It's totally the SEO part.

As of my understanding, it's might be because of the level of url depth. It might be the high priority of the /posts instead of /posts/slug.

I suggest you to follow the seo part properly in your site, that might be helpful.

Activity icon

Replied to Authenticated Users Are Directed To The Subdomain.

@dembilesmana You can use auth middleware in the route for making your route protected and redirect to test.dev/login.

To redirect to the subdomain (subdomain.test.dev), you need to adjust your redirect link. To do so, check here- https://stackoverflow.com/questions/28702372/how-to-change-default-redirect-url-of-laravel-5-auth-filter

Mar
07
1 month ago
Activity icon

Awarded Best Reply on How To Update A HasOne Relationship?

@rjruiz

I believe it's because you are trying to update the relationship on the update method, which normally returns boolean.

Ref: https://laravel.com/api/7.x/Illuminate/Database/Eloquent/Model.html#method_update

What if you try this approach?

$piece = Piece::with('program')->findOrFail($id); 

// You can update piece object from easily, instead of roaming
$piece->update([
    'denomination' => $request['denomination'],
    'code'         => $request['code'],
    'time'         => $request['time'],
    'part_piece'   => $request['part_piece'],         
    'gag_id'       => $request['number_gag'],         
    'program_id'   => $piece->program->id                     
]);

// Update program relationship and return either 0 or 1 based on the executiobn. 
$piece->program->update($request->all());

$piece->syncTools($request->get('tools'));
Activity icon

Replied to How To Update A HasOne Relationship?

@rjruiz

I believe it's because you are trying to update the relationship on the update method, which normally returns boolean.

Ref: https://laravel.com/api/7.x/Illuminate/Database/Eloquent/Model.html#method_update

What if you try this approach?

$piece = Piece::with('program')->findOrFail($id); 

// You can update piece object from easily, instead of roaming
$piece->update([
    'denomination' => $request['denomination'],
    'code'         => $request['code'],
    'time'         => $request['time'],
    'part_piece'   => $request['part_piece'],         
    'gag_id'       => $request['number_gag'],         
    'program_id'   => $piece->program->id                     
]);

// Update program relationship and return either 0 or 1 based on the executiobn. 
$piece->program->update($request->all());

$piece->syncTools($request->get('tools'));
Activity icon

Replied to Laravel Admin Panel

@karolgil Beside @sergiu17 suggestion, I recommend checking this list too-

https://www.dunebook.com/best-laravel-admin-panel/

Activity icon

Replied to Eloquent Does Not Relate Model

@sergionc

It means that you don't use the default foreign key. You need to adjust based on the way you define the key in your table.

Check more: https://laravel.com/docs/7.x/eloquent-relationships#one-to-many

Activity icon

Replied to Eloquent Does Not Relate Model

@sergionc

Try this-

$ciudadeslista = Ciudad::with('regions')->get();

dd($ciudadeslista); // It will return the collecction of ciudadeslista. 

dd($ciudadeslista[0]->regions); // It will return the collecction of regions of first item of ciudadeslista. 

dd($ciudadeslista[0]->regions[0]); // It will return the first item of regions of first item of ciudadeslista. 

If you want to see everything, you can run loop on that.

For example-

foreach($ciudadeslista as $ciudad){
	foreach($ciudad->regions as $region){
		echo $region->nombre_region;
	}
}