stock;
return sprintf('
%s
',
$stock < 10 ? 'bg-red-100 text-red-800' : 'bg-green-100 text-green-darker',
$stock
);
};
}
/**
* Show as link
*
* @param string $title
*/
public static function asLink(string $link, int|string|null $title): Closure
{
return fn () => sprintf(' %s ', $link, $title);
}
/**
* To turkmen date d.m.Y
*/
public static function tmDate(): Closure
{
return fn ($value) => $value?->format('d.m.Y');
}
/**
* Has permission for canSee or canRun methods
*/
public static function hasPermission(string $permissionName = 'systemUsers'): Closure
{
return fn ($request) => $request->user()->can('isAdmin');
}
}