How to access my lang files from controller in laravel 5

You are missing a use statement for the Lang class and PHP is looking for it in the current namespace, that's why you see App\Http\Controllers\Lang in the error message.

It works in the view, as view files are executed in global namespace, where the Lang facade exists.

In order for your code to work do one of the following:

  1. Use fully qualified class name for Lang

    $var = \Lang::get('directory/index.str1');
    
  2. Add use statement at the top of your controller

    <?php namespace App\Http\Controllers;
    use Lang;
    

You can as well use the __ helper (Works for Laravel 5.5, 5.6 and 5.7 ... not sure about the other versions). e. g if your array of strings are stored in a file called messages.php inside lang directory, to get a string with the key myString, use the following in the controller:

__('messages.myString');

In blade template you would use:

@lang('messages.myString')