Esempio n. 1
0
 public function testForumDelete()
 {
     $this->create();
     $before = $this->tester->grabRecord('forums', ['name' => 'B']);
     Forum::where('name', 'A')->delete();
     $after = $this->tester->grabRecord('forums', ['name' => 'B']);
     $this->assertEquals($before->order - 1, $after->order);
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->model('user', 'Coyote\\User');
     $router->model('post', 'Coyote\\Post');
     $router->model('topic', 'Coyote\\Topic');
     $router->pattern('id', '[0-9]+');
     $router->pattern('forum', '[A-Za-z\\_\\/]+');
     $router->pattern('tag', '([\\p{L}\\p{Mn}0-9\\._+-]+)');
     $router->bind('forum', function ($path) {
         $result = \Coyote\Forum::where('path', $path)->first();
         if (!$result) {
             abort(404);
         }
         return $result;
     });
     parent::boot($router);
 }