FEATURE: merge template namespace and module alias

This commit is contained in:
Michal Kváček
2017-02-10 13:45:41 +01:00
parent 9451357e02
commit 35bda2828c
7 changed files with 16 additions and 26 deletions
@@ -11,15 +11,9 @@ use Pingpong\Modules\Routing\Controller;
class CreateNewComment extends Controller
{
public function postNew(\Modules\Blog\Article\Http\Requests\CreateNewComment $request, $articleId)
public function store(\Modules\Blog\Article\Http\Requests\CreateNewComment $request, \Modules\Blog\Article\Entities\Article $article)
{
$article = Content::where('id', $articleId)
->where('moduleHandler', Article::class)
->firstOrFail();
$article->moduleSettings = json_decode($article->moduleSettings);
if (!isset($article->moduleSettings->allowComments) || !$article->moduleSettings->allowComments) {
if (!isset($article->moduleSettings['allowComments']) || !$article->moduleSettings['allowComments']) {
return redirect()
->route('page.content', ['url' => $article->url])
->with('error', trans('article::comments.disabledComments'));
@@ -28,7 +22,7 @@ class CreateNewComment extends Controller
$content = $request->message;
$user = Auth::user();
if ($user) {
$name = $user->name;
$name = is_null($user->name) ? $user->email : $user->name;
$email = $user->email;
} else {
$name = $request->name;
+1 -1
View File
@@ -22,7 +22,7 @@ Route::group([
// public routes
Route::group(['middleware' => ['web'], 'namespace' => 'Visitor'], function () {
Route::post('comments/new/{id}', 'CreateNewComment@postNew')
Route::post('comments/new/{article}', 'CreateNewComment@store')
->name('comments.new');
});
});