コード例 #1
0
ファイル: Model.php プロジェクト: sahanh/resto
 /**
  * Get the resource instance for this model
  * @return Resto\Common\Resource
  */
 public static function getResource()
 {
     $namespace = Str::classNamespace(get_called_class());
     if (!$namespace) {
         throw new InvalidResourceException('Model must be inside a namespace.');
     }
     return Resource::resolve($namespace);
 }
コード例 #2
0
ファイル: StrTest.php プロジェクト: sahanh/resto
 public function testClassNamespace()
 {
     $this->assertEquals('Foo\\Bar', Str::classNamespace('Foo\\Bar\\User'));
 }