tisuchi

Software Developer at GLEIF

Member Since 6 Years Ago

Dhaka, Bangladesh

Experience Points
777,075
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
1853
Lessons
Completed
Best Reply Awards
712
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 50
777,075 XP
Jan
16
1 week ago
Activity icon

Awarded Best Reply on Search In Table Related To Eloquent

@datanorte You can use whereHas() in that case. I assume that brand table has name field and category has title filed those you want to search.

public function render()
{
    $data_products = Product::with('brand', 'category')->orderBy('id', 'desc')
        ->where('name', 'like', '%' . $this->search . '%')
        ->orWhereHas('brand', function($query) use($search = $this->search){
        	$query->where('name', '%' . $search . '%')
        })->orWhereHas('category', function($query) use($search = $this->search){
        	$query->where('title', '%' . $search . '%')
        })->paginate($this->perPage);

    return view('livewire.products', compact('data_products'));
}

Note: You need to adjust the query based on your requirements.

Ref: https://laravel.com/docs/8.x/eloquent-relationships#querying-relationship-existence

Activity icon

Awarded Best Reply on IsoFormat Error In Laravel

@amit028 Is that somehow a composer installation issue?

Can you try this?

composer clearcache
composer install
Jan
12
1 week ago
Activity icon

Replied to Composer Error When I Try To Use Composer Commands

@deekshith It's a php / laravel package.

Allow you to display update/upgrade instructions to your library users.

Ref: https://github.com/kylekatarnls/update-helper

Activity icon

Replied to Composer Error When I Try To Use Composer Commands

@deekshith This means, your php version is 7.1.33 but for some reasons (probably some of the packages need a higher version of php) composer required 7.2.5 version or above.

So, if possible, I strongly suggest you to upgrade php version at least. It's recommeneded also to upgradate Laravel version (The current version is 8 and you are using 5.5)

Activity icon

Replied to Composer Error When I Try To Use Composer Commands

@deekshith Try-

I have had to delete the directory kylekatarnls located inside my vendor directory then run composer update --prefer-source and after that composer dump-autoload.

Ref: https://stackoverflow.com/questions/61236961/composer-dump-autoload-or-update-results-in-fatal-error-on-laravel-5-5

Activity icon

Replied to Take Specific Column From Multi-dimensional Arra

@tapas Doesn't it simpler approach?

Model::get('company_name', 'position');
Jan
09
2 weeks ago
Activity icon

Replied to Display Products Of Each Category In Laravel

@mehrdad70 Try this-

public function showCourses()
{
    $courses = Course::with('categories')->get()

	retuern view('front.courses.all-courses', compact('courses'));
}

all-courses.blade.php

@foreach($courses as $course)
	// To print anything from category table
	{{ $course->categories->fieldName }}
@endforeeach

Here you need to adjust the fieldName based on your table column.

SideNote: I highly recommend you to check this doc and watch some basic laravel series that will boost up your skills.

Jan
08
2 weeks ago
Activity icon

Replied to How To Save Two Different Data In One Column.

@emfinanga It's because of you are assigning slave_id into unit_id. Look at your following code that is wrong-

$data = New Mystock;
$data->unit_id = $value->unit_issue_id;
$data->unit_id = $value->slave_id;

It should be like this-

$data = New Mystock;
$data->unit_id = $value->unit_issue_id;
$data->slave_id = $value->slave_id;
...

You just adjust your $data->slave_id if the table column is wrong.

Jan
07
2 weeks ago
Activity icon

Replied to Best­č¬íWay

@konstruktionsplan First of all, your query has an issue mentioned by @prasadchinwal5 . Check it out.

Secondly, if you are looking for the best way, then I would recommend you to use eloquent for that. Since you are able to join tables via the foreign key, you can easily build a relationship between them. Then you can create a dedicated method to grab the point.

Activity icon

Replied to File Upload Refactoring

@uniqueginun The approach suggested by @tray2 looks clean enough already.

Why not you just create separate methods and handle all the logic insider them.

BTW, you can use a loop if you want, but since you can solve any issue without the loop, then what is the purpose of using it? Looping will make iteration, which may affect your performance (depends on how many times it iterate). Therefore I believe looping is unnecessary use here.

Activity icon

Replied to Develop RSS News Feed With Laravel And RSS Tracker In Localhost?.

@munazzil If I understand you correctly, you want to fetch real-time.

In that situation, you need to use any JS library / Cron Job for pulling data at certain intervals. Or you need to use any third-party library to solve the issue.

Activity icon

Replied to File Upload Refactoring

@uniqueginun First of all, if your current code works fine, I would say just follow the simple step, that currently has.

Secondly, if you submit multiple form on same action and not sure whether in future it will submit more form or not, on that situation, you can follow a separate class for each form submittion based on a contract (Interface), that will be following Open Closed Principle (Some may be refer it over engineering of it here).

That's what I can think of now.

Jan
06
2 weeks ago
Activity icon

Awarded Best Reply on Accessing Parent Method From Subclass Instantiation

@zaimazhar You just add return $this; in your awarded() method. That should work.

public function awarded($user) {
        $this->user = $user;

        return $this;
    }
Activity icon

Replied to Accessing Parent Method From Subclass Instantiation

@zaimazhar You just add return $this; in your awarded() method. That should work.

public function awarded($user) {
        $this->user = $user;

        return $this;
    }
Activity icon

Replied to File Upload Refactoring

@uniqueginun Why do you need refactoring here? I cannot see any complexity here.

Activity icon

Replied to IsoFormat Error In Laravel

@amit028 Is that somehow a composer installation issue?

Can you try this?

composer clearcache
composer install
Jan
05
2 weeks ago
Activity icon

Awarded Best Reply on How Can I Give Multiple Condition In @can Laravel

@niush If I understand correctly, @canany() will check whether the user is eligible for any of the gate of the given array. Correct me if I am wrong.

@nafeeur10 I found the following in the discussion, but not in the official documentation. You can try it if it works.

@if(Gate::check('user_manage') && Gate::check('client_manage'))

@endif

Ref: https://stackoverflow.com/questions/34188461/laravel-5-1-can-how-use-or-clause

Activity icon

Replied to How Can I Give Multiple Condition In @can Laravel

@niush If I understand correctly, @canany() will check whether the user is eligible for any of the gate of the given array. Correct me if I am wrong.

@nafeeur10 I found the following in the discussion, but not in the official documentation. You can try it if it works.

@if(Gate::check('user_manage') && Gate::check('client_manage'))

@endif

Ref: https://stackoverflow.com/questions/34188461/laravel-5-1-can-how-use-or-clause

Jan
02
3 weeks ago
Activity icon

Replied to BelongsToMany Take 1 .

@binggle Actually you are right if you try many to many relationships.

In that case, the access way would be a bit different.

$category = Cat::find(1);

foreach ($category->videos as $video) {
    //
}

Ref: https://laravel.com/docs/8.x/eloquent-relationships#many-to-many-model-structure

Activity icon

Replied to Trying To Get Property 'courses' Of Non-object

@mehrdad70 Can you dd($cart) and show the output of it?

Activity icon

Replied to Call To Undefined Method Illuminate\Database\Eloquent\Relations\MorphMany::attach()

@neeraj1005 Just to confirm, isn't that unnecessary to pass user id to validation data since you are using attach()? It should take user_id automatically. Correct me if I am wrong.

Activity icon

Replied to BelongsToMany Take 1 .

@binggle I think you provided belongsToMany() in both sides. Therefore, you are getting only one result.

So, you need to change your relationship a bit.

On cat.php model-

public function videos()
    {
        return $this->hasMany( Video::class, 'cat_video' )->withTimestamps();
    }

Now it should work.

Ref: https://laravel.com/docs/8.x/eloquent-relationships#one-to-many

Activity icon

Replied to Trying To Get Property 'courses' Of Non-object

@mehrdad70 Just wrap by if condition. It will ensure that the $cart return values.

$cart = Auth::user()->carts()->where('status', Cart::Active)->first();

//The reason for this error is
if($cart){
	if(!is_null($cart->courses)){
	    $courses = $cart->courses;
	    return view('front.shoping-cart.cart', compact('courses', 'cart'));
	}else{
	    $cart->delete();
	    return view('front.shoping-cart.empty-cart');
	}	
}

Jan
01
3 weeks ago
Activity icon

Replied to Laravel Pagination Multilang

@caglayantolga35 I never worked for pagination. But I guess this link might be helpful for you.

Activity icon

Replied to How Can I Save Request Data Into Database At Once?

@cola Yes, it should be like that, I believe.

Activity icon

Awarded Best Reply on Parse Error I Need Answer

@c├╝neyd alper dereli In the constructor, you need to give space after function keyword. Currently, there is no space.

It should be-

public function __construct($pdo){
	$this->pdo = $pdo;
}
Activity icon

Replied to Parse Error I Need Answer

@c├╝neyd alper dereli In the constructor, you need to give space after function keyword. Currently, there is no space.

It should be-

public function __construct($pdo){
	$this->pdo = $pdo;
}
Activity icon

Replied to How Can I Save Request Data Into Database At Once?

@cola You can. But you need to change a few things-

User::create($request->only(['firstName', 'lastname', 'email', 'password']));

Now in your model, make sure that you allow mass assignment.

User.php

protected $guarded = [];

// This for password bcrypt. 
public function setPasswordAttribute($value){
	$this->password = bcrypt($value);
}
Activity icon

Replied to Parse Error I Need Answer

@c├╝neyd alper dereli Show your code. You have made a mistake in your code probably.

Dec
31
3 weeks ago
Activity icon

Awarded Best Reply on Optional Inclution Of Template

@afoysal May be you can create an another @yield then use that new yield for inserting header and sidebar template.

For example-

<body>
    <div id="main-wrapper">
        @yield('extra-layout')
        <div class="content-body">
            <div class="container">
                @yield('content')
            </div>
        </div>
    </div>
    @include('modal')
    @include('layouts.footer-script')
</body>

Now, wherever you need, in the extended template would be-

@section('extra-layout')
	@include('layouts.header')
        @include('layouts.sidebar')
@stop
Activity icon

Replied to Undefined Variable Exception When Queuing Notifications

@elo Does log file show more details? Have you used any variable $totalSponsorshipAmt in the blade file?

Activity icon

Replied to Where To Begin In Laravel?

@refschool I have an old answer. You may check also here

Activity icon

Replied to SQLSTATE[HY000]: General Error: 1366 Incorrect Integer Value: 'on' For Column 'isChecked' At Row 1 (SQL: Insert Into `rfqs` (`product_name`, `product_category_id`, `sub_category_id`, `product_quantity`, `unit_id`, `city`, `isChecked`, `details`, `user_id`

@neeraj1005 Yes, but once you submit the form, normally checkbox returns on or off based on whether you checked or not.

Since you directly create the value into the table, Rfq::create($validatedData); therefore it takes checkbox value as on. That's why I suggest whether you change the value as an attribute or change the table value to a string.

Activity icon

Replied to Optional Inclution Of Template

@afoysal May be you can create an another @yield then use that new yield for inserting header and sidebar template.

For example-

<body>
    <div id="main-wrapper">
        @yield('extra-layout')
        <div class="content-body">
            <div class="container">
                @yield('content')
            </div>
        </div>
    </div>
    @include('modal')
    @include('layouts.footer-script')
</body>

Now, wherever you need, in the extended template would be-

@section('extra-layout')
	@include('layouts.header')
        @include('layouts.sidebar')
@stop
Activity icon

Replied to SQLSTATE[HY000]: General Error: 1366 Incorrect Integer Value: 'on' For Column 'isChecked' At Row 1 (SQL: Insert Into `rfqs` (`product_name`, `product_category_id`, `sub_category_id`, `product_quantity`, `unit_id`, `city`, `isChecked`, `details`, `user_id`

@neeraj1005 It's because you set column type as an integer and providing some text (by default check box return on or off).

Probably you can set mutator here

public function setIsCheckedAttribute($value)
{
    $this->attributes['isChecked'] = (bool) $value;
}

Or on the migration file, just set the integer to string. Like that-

$table->string('isChecked');

Ref: https://stackoverflow.com/questions/42166853/store-true-as-1-false-as-0-using-laravel-eloquent-mysql

Activity icon

Replied to Looking To Hire A PHP/Laravel Developer

@mkellyxp This may not the right place to post. However, if you want, you can post your job at https://larajobs.com/

Activity icon

Replied to Can't See Error

@nikhillvl Make sure, you have .env file in the project.

And if it's in local environment, turn APP_DEBUG=true value into true.

Dec
30
3 weeks ago
Dec
29
3 weeks ago
Activity icon

Awarded Best Reply on Showing User Posts

@pt-83 The view should be like this-

@foreach ($posts as $post) 
	<div class="blogs bg-white mr-5">
	     <img src="{{ $post->file }}" class="">
	     <div class="p-5">
	    <h1 class="text-2xl font-bold text-green-800 py-2">{{ $post->title }}</h1>
	     <p class="bg-white text-sm text-black">{{ $post->body }}</p>
	     <a href="{{ route('posts.show', $post) }}" class="py-2 mt-4 px-6 text-white bg-green-500 inline-block rounded">Read More</a>
	     </div>
	</div>
@endforeach
Activity icon

Replied to Showing User Posts

@pt-83 The view should be like this-

@foreach ($posts as $post) 
	<div class="blogs bg-white mr-5">
	     <img src="{{ $post->file }}" class="">
	     <div class="p-5">
	    <h1 class="text-2xl font-bold text-green-800 py-2">{{ $post->title }}</h1>
	     <p class="bg-white text-sm text-black">{{ $post->body }}</p>
	     <a href="{{ route('posts.show', $post) }}" class="py-2 mt-4 px-6 text-white bg-green-500 inline-block rounded">Read More</a>
	     </div>
	</div>
@endforeach
Activity icon

Replied to Lesson 3 TDD: Differences Between Create, Make, Raw

@gianmarx

If you have extended a model, you may wish to extend its factory as well in order to utilize the child model's factory attributes during testing and seeding. To accomplish this, you may call the factory builder's raw method to obtain the raw array of attributes from any given factory:

For example-

$factory->define(App\Admin::class, function (Faker\Generator $faker) {
    return factory(App\User::class)->raw([
        // ...
    ]);
});

Ref: https://laravel.com/docs/7.x/database-testing

Activity icon

Replied to Lesson 3 TDD: Differences Between Create, Make, Raw

@gianmarx The create persists to the database while make just creates a new instance of the model.

The create method not only creates the model instances but also saves them to the database using Eloquent's save method

https://laravel.com/docs/8.x/database-testing#creating-models-using-factories

Activity icon

Awarded Best Reply on Target Class...does Not Exist Error Only On Production, Not Dev

@aylara I guess it's the issue of case sensativity. Since it's working fine locally with the code, and if you push your code properly into the server, then change this code. Locally it may not affect but on the server, Api is not the same as api.

It should be

Route::apiResource('enquiries','Api\WebsiteEnquiryController');

Instead of -

Route::apiResource('enquiries','api\WebsiteEnquiryController');
Activity icon

Replied to HasOne Relationship With Condition

@uniqueginun well, in that case, you are trying to match with a specific date. Now question is, how do you store data in your DB? What is formate?

BTW, are you getting anything with substitutionEmployee()?

Activity icon

Replied to HasOne Relationship With Condition

@uniqueginun It should work. Actually, it will get the associate start_date from the model.

Activity icon

Replied to Why Do I Get "Page Expired" With Laravel Login Method In Postman?

@cola I am not so sure exactly why it's happened on your side, but a very close issue like you is here

Community Pillar

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