我有一个系统,用户放置一些坐标(纬度/经度),我需要检查指定的坐标是否在海中.有什么服务可以给我答案.或者是否可以使用谷歌地图这样做.
我需要使用数据透视表的id作为另一个表中的外键.
例如,我有以下表格:
users: id, username, ...
places: id, placename, lat, lng, ...
place_user: id, user_id, place_id
routes: place_user_id, lat, lng, inserted_at.
Run Code Online (Sandbox Code Playgroud)
因此,当用户说我要去那个地方时,我在place_user表中有一个新条目,并开始记录他到达那里的路线.因此,对于每个place_user条目,我在路由表中有许多条目.
用雄辩的方式做出这种关系的正确方法是什么?我应该为数据透视表创建一个模型吗?
我试图通过以下解决方案解决我的问题,但没有运气:https://github.com/laravel/framework/issues/2093#issuecomment-39154456并在那里发表评论https://github.com/laravel/framework /问题/ 2093#issuecomment-58187802
任何建议将不胜感激.
我正在尝试测试我的类InvalidArgumentException,但我得到了
测试\ BarTest :: should_receive_parameter缺少Itdc\Foo\Bar :: __ construct()的参数1,在第10行的/mypath/foo/tests/BarTest.php中调用并定义
这是我使用的测试(BarTest.php)文件:
<?php namespace Tests;
use Itdc\Foo\Bar;
class BarTest extends \PHPUnit_Framework_TestCase {
/** @test */
public function should_receive_parameter() {
$this->setExpectedException('Exception');
$id = new Bar;
}
}
Run Code Online (Sandbox Code Playgroud)
这是Bar类:
<?php namespace Itdc\Foo;
class Bar {
public function __construct($a) {
// do something
}
}
Run Code Online (Sandbox Code Playgroud)
我试图在注释部分puth setExpectedException,也试图使用InvalidArgumentException,但没有运气.
任何建议我做错了将不胜感激.
php ×3
coordinates ×1
eloquent ×1
exception ×1
google-maps ×1
javascript ×1
laravel ×1
laravel-4 ×1
phpunit ×1
web-services ×1