tisuchi

Sr. Software Engineer at Avana

Member Since 4 Years Ago

Dhaka, Bangladesh

Experience Points
427,095
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
1564
Lessons
Completed
Best Reply Awards
287
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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
427,095 XP
Oct
12
3 days ago
Activity icon

Replied to Syntax Error On Group By

@mattb

Once you turn strict to false, it shouldn't break your code. It should work fine. Try first.

BTW, have you checked this? https://stackoverflow.com/questions/40917189/laravel-syntax-error-or-access-violation-1055-error

Activity icon

Replied to Chunk

Basically it will grab all the records from the DB but load 100 records in the memory. It's kind of limit and offset in pagination.

You better read the chunk part here. http://laravel-school.com/posts/laravel-pagination-vs-chunk-51

Activity icon

Replied to How To Create Profile URL Like Laracasts?

I think adding @ simply in front of your slug will solve your issue.

Route::get('@{slug}', '[email protected]');

Try.

Oct
10
5 days ago
Activity icon

Replied to Attendance Value Problem In Laravel

Then maybe you can use any local calendar to get the local holidays. Then you can apply your logic on that based on working days.

I am not sure, you can try google calendar also if it supports.

Oct
09
6 days ago
Activity icon

Replied to Attendance Value Problem In Laravel

So far I can understand that, the major changes between two projects are the value for the present, half-day and absent. So, in that case, why not you just count how many present and half day to get the total present in a month. Isn't that working for you?

Suggestion: To be honest, it is advisable to store a numeric number for your present, half day and absent value in db. It will be easier for handling.

Oct
08
1 week ago
Activity icon

Replied to My Question

Personally I recommend you not to store in another table. If you store in another table, you need to update relative tables also once the data has changed in the main table.

So, it is advisable to retrieve data based on your demand.

Sep
29
2 weeks ago
Activity icon

Replied to Laravel | Routing Overlapping Problem

If you change your route order a bit, I guess it will work for you.

Route::get('contact/', '[email protected]');
Route::get('/{slug}', '[email protected]');

Order slug in the bottom.

Activity icon

Replied to How To Make A Single Form For Edit And Update And Also For Adding

If you have the same properties for your forms for creating and updating, then you just need to change the form action only.

In that case, you can try this way-

<form action="@if(Route::currentRouteName() == 'something.create') 'something.create' @else 'something.update' @end" method="POST" />

Here, something.create or something.update is the name of your create and update route accordingly.

Sep
25
2 weeks ago
Activity icon

Replied to Multiple Table Queries

Nope. The answer is bit different than him.

Anyways, thank you.

Activity icon

Replied to Multiple Table Queries

First of all, make sure your $id is returning the data.

Then try this. It should work.

Products::with('company', function($q){
    $q->where('visible', 0);
})->where('category_id', $id)
->groupBy('company_id')->get()
Activity icon

Replied to How To Get Only The Minimum Value ?

Have you tried this way?

return taskStatus::orderBy('order', 'asc')
    ->take(1)
    ->whereIn('id', [3,5,6,7,1,2])->get();
Activity icon

Replied to Multiple Table Queries

You can achieve this by using a relationship.

Products::with('visible', function($q){
    $q->where('visible', 0);
})->where('category_id', $id->id)
->groupBy('company_id')->get()

Now, you have to make sure that you have a relationship between products and companies tables. It should be an a company has many products.

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

Activity icon

Replied to How To Pluralise Word In Laravel?

Have you tried with str_plural()?

In your view, you can try this way.

{{ $users }} {{ str_plural('user', $users) }}

Ref: https://laravel.com/docs/6.x/helpers#method-str-plural

Sep
23
3 weeks ago
Activity icon

Replied to Find Collection By Id

Maybe you can use whereHas().

$customer_ledger=Sales::whereHas('customer')
        ->with('customer')
        -> select('invoice_no','customer_id','created_at',DB::raw('sum(amount) as totalM'))
        ->where('customer_id', $id)
        ->groupby('invoice_no','customer_id','created_at')
        ->get();
Activity icon

Replied to Laravel Eloquent JOINS & Relationships Issue

That suppose to be one to many, as of I am thinking right now. Again it depends on your plan, to be honest.

Activity icon

Replied to Laravel Eloquent JOINS & Relationships Issue

@engrlaravel

Have you tried this?

$plans = Plan::with('positions')
        ->doesnthave('vacancy')
        ->where('created_by', 7)
        ->get();

You have to make sure that, you have the proper relationship with plan, positions and vacancy tables.

Sep
16
4 weeks ago
Activity icon

Replied to Facebook\WebDriver\Exception\SessionNotCreatedException: Session Not Created

@hasibweb

Actually I was facing this issue also. Mainly I found this issue for not having an updated version of google chrome. I believe, if you update your chrome version, you won't see this anymore.

Still, if you are facing this issue, check out this discussion. https://github.com/laravel/dusk/issues/641

Aug
29
1 month ago
Activity icon

Replied to API For Mobile Application

@pnandu1990

As per I know, there is no dedicated series about API for the mobile client in Laravel.

However, you can check it out this- https://laracasts.com/series/laravel-vue-and-spas

Aug
28
1 month ago
Activity icon

Replied to Anyway To Pass Parameter Into Eloquent Function?

Yeah, correct. I didn't know that. Thank you, guys.

@kankai the best approach for your issue is @martinbean solution.

Activity icon

Replied to Anyway To Pass Parameter Into Eloquent Function?

He is trying to apply to the relationship. Can we do like that way also?

Wouldn't be applied to the $game_id?

$game_id->detail()->whereDate('created_at', '=' $date)->get();
Aug
27
1 month ago
Activity icon

Replied to Laravel Cart Not Picking Up Food Price

@matildah

In general, I have a suggestion about your code.

It is highly recommended to avoid put logical code in your view. It doesn't look good at all.

<?php $total += (int)$details['price'] *(int)$details['quantity'] ?>
Activity icon

Replied to Pivot Tables Issue

@conixs

I believe, this discussion is closed to your issue. Maybe it will helpful for you. https://stackoverflow.com/questions/23336145/laravel-how-to-use-multiple-pivot-table-relationships

Activity icon

Replied to How To Check If Variable Is Empty/null/NULL/not Set/0

@engrlaravel

There are probably two options I can think of right now.

  1. You need to write a regular expression then check whether it return value or not. In that case, you can easily handle without using many built-in functions.

  2. By somehow if you need to use built-in functions, I believe you have to use at least two functions to cover all . of your criteria.

Now choose is yours, which one you will pick up.

Aug
26
1 month ago
Activity icon

Replied to User : FindOrFail Return First_name And Last_name In Attributes But $user->first_name Is Empty

@mostafalaravel

It's because of the following code in your model-

public static function boot()
    {
        static::creating(function ($user) {
            //$fullName = explode('.',strstr($user->email, '@', true));
            $user->first_name = "";
            $user->last_name = "";
        });

        parent::boot();
    }

If you take it off, it should work fine.

Activity icon

Replied to How To Check If Variable Is Empty/null/NULL/not Set/0

@engrlaravel

If this data comes from the user form, you can define everything in form validation part. It will be easier for you to handle.

Activity icon

Replied to How To Get Client_id, Client_secret In Google +?

@mstdmstd I believe you will get a lot of tutorials online.

Have you checked this? https://demonuts.com/laravel-google-login/

Activity icon

Replied to Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_PARSE) Syntax Error, Unexpected '$subcategory' (T_VARIABLE)

@kanchan186

I think the line of 83 should be like this-

$subcategory= \DB::table('subcategories')
          ->join('products','subcategories.p_id','=','products.p_id')
          ->join('categories','subcategories.c_id','=','categories.c_id')
          ->get();

You need to use DB to join tables instead of eloquent.

I just reindent the whole code because it's not readable. It should be like this-

<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\product;
use App\category;
use App\subcategory;
use File;

class SubcategoryController extends CategoryController {
    
    public function addstg() {
        $product = product::get();
        $category = category::get();
        $subcategory = subcategory::get();
        return view('addstg', compact('product', 'category', 'subcategory'));
    }
    
    public function store2(Request $request) {
        if ($request->hasFile('s_image')) {
            $file = $request->file('s_image');
            $destinationPath = public_path() . "/sub_img";
            $filename = $file->getClientOriginalName();

            if (!File::exists($destinationPath)) {
                File::makeDirectory($destinationPath, $mode = 0777, true);
                $file->move($destinationPath, $filename);
            } else {
                $file->move($destinationPath, $filename);
            }
        }

        subcategory::create([
          'p_id' => request('p_id'), 
          'c_id' => request('c_id'), 
          's_name' => request('s_name'), 
          's_image' => $filename
        ]);

        $product = product::get();
        $category = category::get();
        $subcategory = subcategory::get();

        return redirect('viewsub');
    }

    public function show2() {
        $product = product::get();
        $category = category::get();
        $subcategory = subcategory::get();

        $subcategory= \DB::table('subcategories')
          ->join('products','subcategories.p_id','=','products.p_id')
          ->join('categories','subcategories.c_id','=','categories.c_id')
          ->get();

        return view('subview', compact('category', 'product', 'subcategory'));
        return redirect('subview');
    }
}

Activity icon

Replied to Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_PARSE) Syntax Error, Unexpected '$subcategory' (T_VARIABLE)

@kanchan186

There should be a line number in this test Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_PARSE) syntax error, unexpected '$subcategory' (T_VARIABLE).

Show the line number.

Activity icon

Replied to How To Get Client_id, Client_secret In Google +?

The Google Plus service is shut down only. The rest of the services from Google is working perfectly. For example Gmail, you can use it smoothly.

Activity icon

Replied to Laravel Add Attachment File From Public Folder To Email

Have you tried with attachFromStorage() since you are trying to attach the file from the public path?

Check the Attaching Files from Disk https://laravel.com/docs/5.8/mail#attachments

Activity icon

Replied to Anyway To Pass Parameter Into Eloquent Function?

Instead of using relationship in the detail() method, may be you can use Local Scope to fix this issue. I believe you can easily pass parameter in scope.

Ref: https://laravel.com/docs/5.8/eloquent#local-scopes

Activity icon

Replied to How To Get Client_id, Client_secret In Google +?

Just to inform you that-

Legacy Google+ APIs have been shut down as of March 7, 2019. Changes to the shutdown plan have been made recently which may mitigate its effect on some developers. Learn more. Google+ integrations for web and mobile apps have also stopped functioning as of March 7, 2019. Learn more.

Reference: https://developers.google.com/+/web/api/rest/

Jul
24
2 months ago
Activity icon

Replied to How To Upgrade PHP In Mac?

If I understand you properly, it's called installation PHP globally. Of course, there are many tutorials around, however, I wrote tips on how to upgrade PHP version on Mac. Check this post. http://laravel-school.com/posts/macbook-update-php-version-globally-35

Jul
23
2 months ago
Activity icon

Replied to Eloquent Relationship Collection With Name 'links' Returning Null

If I am not mistaken, it conflicts with links() from pagination. I am not sure whether you can use it or not. But since it works changing the name a bit, better use changed name.

https://laravel.com/api/5.8/Illuminate/Pagination/Paginator.html#method_links

Jul
16
2 months ago
Activity icon

Replied to How To Use 1 ,2 3 In Slug Laravel ?

In your post, you can create a new method like this way-

public function setSlugAttribute($value)
    {
        if (static::whereSlug($slug = str_slug($value))->exists()) {
            $slug = "{$slug}-{$this->id}";
        }
        $this->attributes['slug'] = $slug;
    }
Activity icon

Replied to How To Get A Specific Categories With Its Sub Categories Item?

Have you tried by fetching relationship data?

Category::with('subcategories')->whereNull('is_parrent')->get();

It should return you sub-categories for each category.

Jul
03
3 months ago
Activity icon

Replied to How To Add Extra Column In Existing Table?

You need to run php artisan make:migration add_profile_photo_to_users in your .terminal. It will create a migration file that you need to update.

Read this: http://laravel-school.com/posts/how-to-add-new-columns-to-the-existing-table-in-laravel-migration-24

Jun
30
3 months ago
Activity icon

Replied to Sum Per User

What you are getting now in this code?

Activity icon

Replied to Multi Language And Verified Route

You may check this. This discussion may help you- https://github.com/laravel/framework/issues/26843

Jun
21
3 months ago
Activity icon

Replied to Email Validation In API.

@LARAVEL007 - Yes, that's what I mean.

Security shoudn't be the biggest concern here because you are just getting a hash to cross-check with DB and then update the data, nothing else.

Activity icon

Replied to Email Validation In API.

I believe in that case, you need to put your activate-manager route code in web since you are trying to access this via web browser.

Jun
15
4 months ago
Activity icon

Replied to How To Use Comma Inside Foreach Loop?

@laravel007

If your intention is to show comma after each element except the last one, you can easily use $loop->last() inside your foreach. I think it will help to fix your issue.

Check this code-

@foreach(explode(', ', $scholarship->selected_subjects) as $subject)
    <a href="{{ route('subjects.show', $subject) }}">
        {{ $subject }} ,
    </a>

    @if( !$loop->last)
        ,
    @endif
@endforeach

Read more: https://laravel.com/docs/5.8/blade#the-loop-variable

Jun
11
4 months ago
Activity icon

Replied to L5.2 [ReflectionException] Class 'ClassName' Does Not Exist

@CAC - Actually, you are right. It supposes to be \\ but it shows single only. I already update my code. Make sure that you have the same code now.

Activity icon

Replied to How To Add Extra Values In Every Result?

@laravel007

There can be few ways to solve your issue. However, I think the easiest way is to add a random temporary number in the view part while you are not storing this data anywhere else.

For example, if you have a users collection in your view, the code can be like this-

@foreach($users as $user)
    {{ $user->temp_code .'-'. \Str::random(4) }}
    // other code inside the loop
@endforeach
Activity icon

Replied to WhereIn Not Working As Expected.

@MOHAMMADBASIR - There are two issues here-

  1. You haven't use the get() so that you are getting this error.

  2. whereIn() allows the integer value only, you have passed the string. You need to work with id instead of name here.

So, the right code should be like this-

public function index(Request $request)
{
        return \App\User::whereIn('id', [1, 2])->get();
}

Here, I assume the user id of username1 is 1 and username2 is 2.

Check More: https://laravel.com/docs/5.8/collections#method-wherein

Activity icon

Replied to WhereIn Not Working As Expected.

It's because you probably pass a string instead of integer in the whereIn().

You better show your whereIn code.

Activity icon

Replied to Class App\Http\Controllers\ValidationsController Does Not Exist

Two suggestions for you.

Firstly, make sure you have the right spelling ValidationsController in the file name and class name.

Secondly, if you have passed the first point, then run the following commands-

composer dump-autoload
php artisan cache:clear 
Activity icon

Replied to Why Getting 404 Error?

@RUHULAMIN - If I get your code correctly, you suppose to get Method not found exception because you have declared Route::post().

If you use get() instead of post(), I think it will fix your issue.

Route::get('admin/posts', '[email protected]');
Activity icon

Replied to Why Getting 404 Error?

@ruhulamin

Check whether other endpoints are working or not.

And it will be better to show your code instead.

Jun
10
4 months ago
Activity icon

Replied to L5.2 [ReflectionException] Class 'ClassName' Does Not Exist

@cac

The psr-4 link suppose to be like this-

"psr-4": {
            "App\\": "app/"
        }

So, your full code is like this-

"autoload": {
        "classmap": [
            "database",
            "app/Http/Controllers",
            "app/Models",
            "app/Console/Commands"
        ],
        "psr-0": {
            "scdda": "app/"
        },
        "psr-4": {
            "App\\": "app/"
        }
    }

It should work now.

In some cases, composer dump-autoload may be required. If you are facing same issue still, run

composer dump-autoload