Skip to content

Commit 29e6982

Browse files
committed
Fix Resource path not found in laravel
1 parent e7d716a commit 29e6982

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@ Hari libur pada plugin ini akan selalu di update tiap tahun.
1111
composer require irfa/php-hari-libur
1212

1313
>You can get Composer [ here]( https://getcomposer.org/download/)
14+
>
15+
16+
<h3>Update this Package</h3>
17+
18+
```
19+
composer update irfa/php-hari-libur
20+
```
21+
1422

15-
***
1623

1724

1825
<h2>🛠️ Laravel Setup </h2>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "\"Plugin ini berfungsi untuk mengecek hari libur nasional\"",
44
"type": "package",
55
"license": "MIT",
6-
"version": "v1.2",
6+
"version": "v1.21",
77
"homepage": "https://github.com/irfaardy/php-hari-libur",
88
"keywords": ["laravel", "holidays", "plugin", "hari libur", "hris","plugin hari libur", "php"],
99
"authors": [

src/Core/Localization.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,19 @@ protected function regionSet($region)
3838
*/
3939
public function holidayData($array = true)
4040
{
41-
$published_file = __DIR__.'../../../../../../resources/irfa/php-hari-libur/'.$this->lang().'.json';
41+
if(function_exists('resource_path'))
42+
{
43+
$published_file = resource_path('irfa/php-hari-libur/'.$this->lang().'.json');
44+
}else{
45+
$published_file = __DIR__.'../../../../../../resources/irfa/php-hari-libur/'.$this->lang().'.json';
46+
}
4247
if(file_exists($published_file))
4348
{
4449
$file = $published_file;
4550
} else{
46-
$file = __DIR__.'../../Data/'.$this->lang().'.json';
51+
$file = __DIR__.'/'.'../../Data/'.$this->lang().'.json';
4752
}
53+
// dd($file);
4854

4955
$this->checkFile($file);
5056
$arr = file_get_contents($file);

0 commit comments

Comments
 (0)