我創建一個表是這樣的:如何處理MYSQL POINT字段Laravel
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('places', function (Blueprint $table) {
$table->engine = 'MyISAM';
$table->increments('id');
$table->text('description');
$table->longText('address');
$table->point('coordinates');
$table->timestamps();
});
}
我使用創造了一個場,直接到我的數據庫:
INSERT INTO `places` (`id`, `description`, `address`, `coordinates`, `created_at`, `updated_at`)
VALUES
(1, 'Plaza Condesa', 'Av. Juan Escutia 4, Hipodromo Condesa, Hipódromo, 06140 Cuauhtémoc, CDMX', X'000000000101000000965B5A0D89693340CC1B711214CB58C0', NULL, NULL);
然後用我找回它在Laravel :
MyModel::first()
所有值似乎是正確的,除了coordinates
領域從哪裏獲得這樣的事情:
�[Z
�[email protected]�q�X�
如何使用Laravel獲得POINT字段?
我沒有。我將它直接保存在mySQL中 – awavi
這就是要點 – awavi
我將它作爲SQL語句導出,但它是POINT(19.xxx -99.xxx) – awavi