小编Cla*_* T.的帖子

Eloquent firstOrCreate文档或用法

我试图寻找一个表来查看一个名为"name"的列是否存在,如果是这样返回值,如果没有创建具有空值的行,我看到firstOrCreate但我无法弄清楚如何使用它为我的生活.

这就是我现在拥有的,有人能伸出援助之手吗?

 class Settings extends Eloquent
        {
            protected $table = 'settings';
            protected $primaryKey = 'name';

            public static function get($settingName)
                {
                    return self::firstOrCreate(array('name' => $settingName));
//                    return self::select(array('value'))->where('name', '=', $settingName)->first()->value;
                }
        }
Run Code Online (Sandbox Code Playgroud)

laravel eloquent laravel-4

7
推荐指数
1
解决办法
9866
查看次数

将 KML 转换为 GeoJson

我在做这件事时遇到了很大的问题,所以我再次寻求帮助。

我有这个庞大的文件,其中包含 Nielson 的所有 DMA,我需要用 php 以某种方式解析每个文件并从中获取数据和坐标,但它们必须以这种格式输出

{"type": "FeatureCollection", "features": [
{
    "type": "Feature",
    "id": "",
    "properties": {
        "dma": "514",
        "name": "Buffalo, NY"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [-79.761951, 42.269861],
                [-79.14959, 42.553193],
                [-79.048361, 42.691959],
                [-78.853455, 42.783961],
                [-78.943961, 42.978357],
                [-78.881611, 43.02363],
                [-78.880756, 43.02955],
                [-78.890068, 43.045268],
                [-78.946342, 43.072051],
                [-79.06977, 43.085841],
                [-79.06467, 43.262754],
                [-78.520257, 43.372277],
                [-77.994839, 43.36526],
                [-77.997291, 43.132981],
                [-77.905934, 43.133562],
                [-77.951044, 43.039544],
                [-77.904562, 43.023492],
                [-77.95633, 42.667882],
                [-78.060469, 42.532888],
                [-77.722965, 42.471217],
                [-77.749931, 41.998782],
                [-77.609815, 41.999367],
                [-77.59813, 41.478577],
                [-78.050728, 41.475103],
                [-78.203422, …
Run Code Online (Sandbox Code Playgroud)

php xml kml geojson xml-parsing

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

eloquent ×1

geojson ×1

kml ×1

laravel ×1

laravel-4 ×1

php ×1

xml ×1

xml-parsing ×1