I wanna make my very own helper, and i put it in app/http/helpers.php
. This is my helper code:
<?php
namespace App\Helpers;
use Auth;
class helper {
public static function is_login() {
if(Auth::check()){
return True;
}else{
return False;
}
}
public static function must_login(){
if(Auth::check()){
return True;
}else{
return Redirect::to('logout');;
}
}
}
?>
and this is my app.php code:
'aliases' => [
'customhelper'=> App\Helpers\Helper::class
]
when i use for my blade file customhelper::is_login()
it work. But when i try to use in my controller customhelper::must_login()
it doesn't work and i've got some error
Class 'App\Http\Controllers\customhelper' not found
via Reynald Henryleo