Skip to content

Commit 9fdf6e9

Browse files
author
Jonathan
committed
publishable commentable stub
1 parent 3d81c66 commit 9fdf6e9

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/CrudgenServiceProvider.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ public function boot()
2828
//default-theme
2929
$this->publishes([__DIR__.'/stubs/default-theme/' => resource_path('crudgen/views/default-theme/')]);
3030

31-
//and default-layout
31+
//default-layout
3232
$this->publishes([__DIR__.'/stubs/default-layout.stub' => resource_path('views/default.blade.php')]);
33+
34+
//and commentable stub
35+
$this->publishes([
36+
__DIR__.'/stubs/commentable/views/comment-block.stub' => resource_path('crudgen/commentable/comment-block.stub')
37+
], 'commentable-stub');
3338
}
3439

3540
/**

src/Services/PathsAndNamespacesService.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Mrdebug\Crudgen\Services;
44

5+
use Illuminate\Support\Facades\File;
6+
57
class PathsAndNamespacesService
68
{
79
public function getStubPath(): string
@@ -181,7 +183,9 @@ public function getRealpathBaseCustomViews($namingConvention)
181183

182184
public function getCommentableCommentBlockPath()
183185
{
184-
return $this->getStubPath().DIRECTORY_SEPARATOR.'commentable'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'comment-block.stub';
186+
$stubPath = resource_path('crudgen/commentable/comment-block.stub');
187+
188+
return File::exists($stubPath) ? $stubPath : $this->getStubPath().DIRECTORY_SEPARATOR.'commentable'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'comment-block.stub';
185189
}
186190

187191
/** paths service */

src/stubs/commentable/views/comment-block.stub

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
{!! Form::open(['method' => 'DELETE','route' => ['{{route_comment}}.destroy', {{comment_variable}}->id]]) !!}
1414
{!! Form::submit('❌', ['class' => 'btn btn-sm']) !!}
1515
{!! Form::close() !!}
16-
1716
</div>
1817
<div class="card-body">
1918
<div class="d-flex flex-start">

0 commit comments

Comments
 (0)