Permalink
Browse files

Episode 58

  • Loading branch information...
JeffreyWay committed Jul 7, 2017
1 parent 66fc118 commit 2add5f48f730e4ff5cfdfe2b0d52d4793acf0e65
@@ -52,16 +52,9 @@ public function update(Reply $reply)
{
$this->authorize('update', $reply);
try {
$this->validate(request(), ['body' => 'required|spamfree']);
$reply->update(request(['body']));
} catch (\Exception $e) {
return response(
'Sorry, your reply could not be saved at this time.', 422
);
}
$this->validate(request(), ['body' => 'required|spamfree']);
$reply->update(request(['body']));
}
/**
@@ -10,7 +10,7 @@
class ThreadsController extends Controller
{
/**
* ThreadsController constructor.
* Create a new ThreadsController instance.
*/
public function __construct()
{
@@ -16,11 +16,8 @@ class NotifyMentionedUsers
*/
public function handle(ThreadReceivedNewReply $event)
{
collect($event->reply->mentionedUsers())
->map(function ($name) {
return User::where('name', $name)->first();
})
->filter()
User::whereIn('name', $event->reply->mentionedUsers())
->get()
->each(function ($user) use ($event) {
$user->notify(new YouWereMentioned($event->reply));
});
@@ -14,9 +14,7 @@ class NotifySubscribers
*/
public function handle(ThreadReceivedNewReply $event)
{
$thread = $event->reply->thread;
$thread->subscriptions
$event->reply->thread->subscriptions
->where('user_id', '!=', $event->reply->user_id)
->each
->notify($event->reply);
@@ -58068,6 +58068,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
//
//
//
//
//
@@ -58529,7 +58531,11 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
})], 1) : _vm._e()])]), _vm._v(" "), _c('div', {
staticClass: "panel-body"
}, [(_vm.editing) ? _c('div', [_c('div', {
}, [(_vm.editing) ? _c('div', [_c('form', {
on: {
"submit": _vm.update
}
}, [_c('div', {
staticClass: "form-group"
}, [_c('textarea', {
directives: [{
@@ -58539,6 +58545,9 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
expression: "body"
}],
staticClass: "form-control",
attrs: {
"required": ""
},
domProps: {
"value": (_vm.body)
},
@@ -58549,18 +58558,18 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
}
})]), _vm._v(" "), _c('button', {
staticClass: "btn btn-xs btn-primary",
on: {
"click": _vm.update
}
staticClass: "btn btn-xs btn-primary"
}, [_vm._v("Update")]), _vm._v(" "), _c('button', {
staticClass: "btn btn-xs btn-link",
attrs: {
"type": "button"
},
on: {
"click": function($event) {
_vm.editing = false
}
}
}, [_vm._v("Cancel")])]) : _c('div', {
}, [_vm._v("Cancel")])])]) : _c('div', {
domProps: {
"textContent": _vm._s(_vm.body)
}
@@ -16,12 +16,14 @@
<div class="panel-body">
<div v-if="editing">
<div class="form-group">
<textarea class="form-control" v-model="body"></textarea>
</div>
<button class="btn btn-xs btn-primary" @click="update">Update</button>
<button class="btn btn-xs btn-link" @click="editing = false">Cancel</button>
<form @submit="update">
<div class="form-group">
<textarea class="form-control" v-model="body" required></textarea>
</div>
<button class="btn btn-xs btn-primary">Update</button>
<button class="btn btn-xs btn-link" @click="editing = false" type="button">Cancel</button>
</form>
</div>
<div v-else v-text="body"></div>

1 comment on commit 2add5f4

@PerJoy

This comment has been minimized.

PerJoy commented on 2add5f4 Oct 23, 2018

If your form is submitted, it will jump.
try write:
@submit change: @submit.prevent.

Please sign in to comment.