File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,18 @@ final class LaravelScrapingBee
13
13
protected array $ params = [];
14
14
protected array $ headers = [];
15
15
16
- public static function make (): self
16
+ public static function make (? string $ apiKey = null ): self
17
17
{
18
- return new static ();
18
+ return new static ($ apiKey );
19
19
}
20
20
21
- private function __construct ()
21
+ public function __construct (? string $ apiKey = null )
22
22
{
23
- $ this ->apiKey = config ('scrapingbee.api_key ' );
23
+ // If somebody pass '' into the constructor, we should use '' as the api key
24
+ // even if it doesn't make sense.
25
+ // If $apiKey is null, then we use the 1 in the config file.
26
+ $ this ->apiKey = $ apiKey ?? config ('scrapingbee.api_key ' );
27
+
24
28
$ this ->baseUrl = config (
25
29
'scrapingbee.base_url ' ,
26
30
'https://app.scrapingbee.com/api/v1/ '
You can’t perform that action at this time.
0 commit comments