1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Usamamuneerchaudhary\Commentify\Providers; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use Illuminate\Support\Facades\Gate; |
7
|
|
|
use Illuminate\Support\ServiceProvider; |
8
|
|
|
use Livewire\Livewire; |
9
|
|
|
use Usamamuneerchaudhary\Commentify\Http\Livewire\Comment; |
10
|
|
|
use Usamamuneerchaudhary\Commentify\Http\Livewire\Comments; |
11
|
|
|
use Usamamuneerchaudhary\Commentify\Http\Livewire\Like; |
12
|
|
|
use Usamamuneerchaudhary\Commentify\Policies\CommentPolicy; |
13
|
|
|
|
14
|
|
|
class CommentifyServiceProvider extends ServiceProvider |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @return void |
18
|
|
|
*/ |
19
|
|
|
public function register(): void |
20
|
|
|
{ |
21
|
|
|
$this->app->bind(CommentPolicy::class, function ($app) { |
|
|
|
|
22
|
|
|
return new CommentPolicy; |
23
|
|
|
}); |
24
|
|
|
|
25
|
|
|
Gate::policy(\Usamamuneerchaudhary\Commentify\Models\Comment::class, CommentPolicy::class); |
26
|
|
|
|
27
|
|
|
$this->app->register(MarkdownServiceProvider::class); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @return void |
33
|
|
|
*/ |
34
|
|
|
public function boot(): void |
35
|
|
|
{ |
36
|
|
|
if ($this->app->runningInConsole()) { |
37
|
|
|
// Publish config file |
38
|
|
|
$this->publishes([ |
39
|
|
|
__DIR__.'/../../config/commentify.php' => config_path('commentify.php'), |
40
|
|
|
], 'commentify-config'); |
41
|
|
|
|
42
|
|
|
$this->publishes([ |
43
|
|
|
__DIR__.'/../../tailwind.config.js' => base_path('tailwind.config.js'), |
44
|
|
|
], 'commentify-tailwind-config'); |
45
|
|
|
|
46
|
|
|
// Add this line to publish your views |
47
|
|
|
$this->publishes([ |
48
|
|
|
__DIR__.'/../../resources/views' => resource_path('views/vendor/commentify'), |
49
|
|
|
], 'commentify-views'); |
50
|
|
|
|
51
|
|
|
// Publish language files |
52
|
|
|
$this->publishes([ |
53
|
|
|
__DIR__.'/../../lang' => resource_path('../lang/vendor/commentify'), |
54
|
|
|
], 'commentify-lang'); |
55
|
|
|
} |
56
|
|
|
$this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
57
|
|
|
$this->loadViewsFrom(__DIR__.'/../../resources/views', 'commentify'); |
58
|
|
|
$this->loadTranslationsFrom(__DIR__.'/../../lang', 'commentify'); |
59
|
|
|
Livewire::component('comments', Comments::class); |
60
|
|
|
Livewire::component('comment', Comment::class); |
61
|
|
|
Livewire::component('like', Like::class); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.