laravel static function in model code example
Example 1: static function model laravel
public static function isOpen($week)
{
return (new static)::where('week', $week)->first();
}
Example 2: laravel call a static function
namespace App\Library;
class Utilities {
//added new user
public static function doBeforeTask() {
// ... you business logic.
}
}
// then do this in your controller
Utilities::doBeforeTask();