Inheritance: extends Illuminate\Database\Eloquent\Model
 public function update($id)
 {
     $post = BeatmapDiscussionPost::findOrFail($id);
     priv_check('BeatmapDiscussionPostEdit', $post)->ensureCan();
     $post->update($this->postParams($post->beatmapDiscussion, false));
     return ['beatmapset_discussion' => $post->beatmapsetDiscussion->defaultJson()];
 }
 public function testPostStoreNewDiscussionRequestBeatmapsetDiscussion()
 {
     $currentDiscussions = BeatmapDiscussion::count();
     $currentDiscussionPosts = BeatmapDiscussionPost::count();
     $this->actingAs($this->user)->post(route('beatmap-discussion-posts.store'), ['beatmapset_id' => $this->otherBeatmapset->beatmapset_id, 'beatmap_discussion_post' => ['message' => 'Hello']])->assertResponseStatus(404);
     $this->assertEquals($currentDiscussions, BeatmapDiscussion::count());
     $this->assertEquals($currentDiscussionPosts, BeatmapDiscussionPost::count());
 }
Beispiel #3
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     //
     Validator::extend('mixture', function ($attribute, $value, $parameters, $validator) {
         return preg_match('/[\\d]/', $value) === 1 && preg_match('/[^\\d\\s]/', $value) === 1;
     });
     BeatmapDiscussion::saving(function ($discussion) {
         return $discussion->isValid();
     });
     BeatmapDiscussionPost::saving(function ($post) {
         return $post->isValid();
     });
     ForumPollVote::saving(function ($vote) {
         return $vote->isValid();
     });
 }