protected $Languages = [ // missing '='
"English" => "en",
"Arabic" => "ar",
"Abkhas" => "ab",
"German" => "de",
"French" => "fr",
"Turkish" => "tr"
];
Tinker not accessing my custom php class
after i watched this episode i decided to make a language menu populated from a custom class (similar to what jeffery did with the country list menu ).
https://laracasts.com/series/build-project-flyer-with-me/episodes/5
i have created a Utilities folder ( App\Http\Utilities ) and added a languages class to that Languages.php
this is my class
<?php
namespace App\Http\Utilities;
class Languages {
protected $Languages = [
"English" => "en",
"Arabic" => "ar",
"Abkhas" => "ab",
"German" => "de",
"French" => "fr",
"Turkish" => "tr"
];
public function all()
{
return $this -> Languages;
}
}
Since then i could't access data instead im receiving this error from tinker
PHP Fatal error: Class 'App\Http\Utilities\Languagese' not found in eval()'d code on line 1
any ideas ???
@nhayder It seems a config file would be more appropriate for this type of thing.
/config/languages.php
<?php
return [
"English" => "en",
"Arabic" => "ar",
"Abkhas" => "ab",
"German" => "de",
"French" => "fr",
"Turkish" => "tr",
];
// Get a specific key
$lang = config('languages.English'); //en
// Get the whole array
$languages = config('languages');
Please or to participate in this conversation.