tisuchi

Member Since 4 Years Ago

Dhaka, Bangladesh

Sr. Software Engineer at Avana

Experience Points 419,025
Experience Level 50

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 1524
Lessons
Completed
Best Reply Awards 280
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.

29 Aug
2 weeks ago

tisuchi left a reply on 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

28 Aug
2 weeks ago

tisuchi left a reply on 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.

tisuchi left a reply on 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();
27 Aug
2 weeks ago

tisuchi left a reply on 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'] ?>

tisuchi left a reply on 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

tisuchi left a reply on 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.

26 Aug
3 weeks ago

tisuchi left a reply on 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.

tisuchi left a reply on 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.

tisuchi left a reply on 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/

tisuchi left a reply on 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');
    }
}

tisuchi left a reply on 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.

tisuchi left a reply on 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.

tisuchi left a reply on 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

tisuchi left a reply on 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

tisuchi left a reply on 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/

24 Jul
1 month ago

tisuchi left a reply on 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

23 Jul
1 month ago

tisuchi left a reply on 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

16 Jul
2 months ago

tisuchi left a reply on 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;
    }

tisuchi left a reply on 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.

03 Jul
2 months ago

tisuchi left a reply on 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

30 Jun
2 months ago

tisuchi left a reply on Sum Per User

What you are getting now in this code?

tisuchi left a reply on Multi Language And Verified Route

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

21 Jun
2 months ago

tisuchi left a reply on 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.

tisuchi left a reply on 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.

15 Jun
3 months ago

tisuchi left a reply on 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

11 Jun
3 months ago

tisuchi left a reply on 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.

tisuchi left a reply on 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

tisuchi left a reply on 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

tisuchi left a reply on 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.

tisuchi left a reply on 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 

tisuchi left a reply on 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]');

tisuchi left a reply on Why Getting 404 Error?

@ruhulamin

Check whether other endpoints are working or not.

And it will be better to show your code instead.

10 Jun
3 months ago

tisuchi left a reply on 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

tisuchi left a reply on What Is The Best API Designer?

@shantodev

There is a lot of option that you can choose.

Personally, I used to swaggerhub that was fine until the project becomes bigger. We feel maintaining the big project is quite difficult with swaggerhub.

Then I discover the StopLight, that's slogan is 10 times faster than swaggerhub. Although in order to use full feature of stoplight, you have to pay, however, the basic uses of stoplight could be one of the best choices of mine personally. Still, I am using StopLight in my project.

Note: Both of these fulfill your requirements.

08 Jun
3 months ago

tisuchi left a reply on Get Replies Count And Reply Likes Count With A Trainer

@KANE - Why not you use relatinship if it suits?

tisuchi left a reply on How To Protect Laravel Website?

Can you share your site url? So that we can check it out here.

tisuchi left a reply on Looking For Some Good Laravel Interview Question.

@shantodev

I personally explore these questions. I think it's one of the good resources.

Besides, some standard discussion about laravel interview is in the reddit group. You can check it out there too...

https://www.reddit.com/r/laravel/search/?q=interview &restrict_sr=1

tisuchi left a reply on Creating A Demo User Account For Web Visitors?

I have a rough idea. You may think of a user role in that situation.

A demo role user should have a read-only accessiblity.

If you don't want to go for board sense, you may simply use a middleware, that you have thought already. Just restrict / allow them in specific routes.

tisuchi left a reply on Ho To Sorting Related Articles Based On Common Tags?

@aarad

Basically whereIn() works with an array of id.

You may simply create another method in your article then filter the related articles via that method. Then, in your $relatedArticle, you just call this easy to get the related content.

tisuchi left a reply on What Is A Middleware?

Basically, the Middleware is a middleman between request and response. It is a type of filtering mechanism. For example, Laravel includes a middleware that verifies whether the user of the application is authenticated or not. If the user is authenticated, he will be redirected to the home page otherwise, he will be redirected to the login page.

You will get many examples of middleware on the internet. However, Jeffrey has a good episode on Middleware too. I think you can take a look that also. https://laracasts.com/series/laravel-from-scratch-2018/episodes/25

tisuchi left a reply on Looking For Your Suggestion.

hmm...

First of all, you can use some build in packages for getting user's data. I think there are a few good packages available besides Google analytics.

Secondly, if you don't want to use any package for that, then you can use fingerprint() build in a method in laravel. I guess it will help you. The fingureprint method is in the request trait.

You can use it like this way-


public function yourMethodName(Request $request){

    $uniqueUser= $request->fingureprint();

}

This fingureprint() will return a unique code for every user. Doesn't matter in which browser or how many tabs you are using. It should be the same for each computer.

tisuchi left a reply on Laravel Model Is Not Working

@RUHULAMIN - I see.

It's because you are not following the proper naming convention. Your table name should be posts.

In that case, you can just add a custom table name in your model.

class Post
{
    protected $table = 'post';

    public function index(){

    }
}

It should work.

tisuchi left a reply on Laravel Model Is Not Working

Most probably it's because of your table name is not following the same naming convention. You better show your code.

tisuchi left a reply on How To Get User's IP Address?

Basically, Request trait provide you user's details out of the box. You can easily get it. For example-

public function index(Request $request)
{
    $userIp = $request->ip();
        $userAgent=  $request->userAgent();
}

And of course, you will get more methods out of the box. Check in Illuminate\Http\Request file.

29 May
3 months ago

tisuchi left a reply on Phpunit Configuration Refresh My Database

@WIZJO - It seems that your user migration table have some issue. May be you can share your code.

Meanwhile, you can do this for refreshing your database.

class ExampleTest extends TestCase
{
    use DatabaseMigrations;
    use RefreshDatabase;

tisuchi left a reply on Forcing A Unique Rule To Ignore Multiple IDs

@thefundi

I cannot understand how-

this can open my application up to SQL injection

Can you show your update code instead?

tisuchi left a reply on Grammar::columnize() Must Be Of The Type Array

Its because get() expect array as a parameter, you provided a string. You need to add an array for fetching *. It will be like this [*];

public function shopBankList($shopId, $fields = 'all')
    {
        return Shopbank::where('shop_id', $shopId)
            ->get( $fields == 'all' ? ['*'] : $fields );
    }

Note: I haven't tested your code yet. I think it should work.

28 May
3 months ago

tisuchi left a reply on 500 Server Error

You should able to see 500 error details in storage/logs folder. There should be either laravel.log or laravel-yyyy-mm-dd.log file. Check why exactly you are facing this issue.

tisuchi left a reply on How To Initialise Filed In PHPStorm?

I use mac, and it's opt + return.

There are a few valuable tips here. Check this- https://phpstorm.tips/tips/21-initialize-fields/