Skip to content

Instantly share code, notes, and snippets.

@edgrosvenor
Created August 30, 2020 17:15
Show Gist options
  • Save edgrosvenor/f4f8f71347b7dacdf92e1cca0c5bd29e to your computer and use it in GitHub Desktop.
Save edgrosvenor/f4f8f71347b7dacdf92e1cca0c5bd29e to your computer and use it in GitHub Desktop.
A POINT column, left to its own devices, results in a messy attempt at a string when sent through ->toArray()
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class College extends Model
{
protected $connection = 'v1';
protected $table = 'colleges_colleges';
// protected $hidden = ['location']; <-- This ultimately solved it
}
/** Here is the array before hiding the location column:
[ 'id' => 2197,
'name' => 'Agnes Scott College',
'short_name' => 'Agnes Scott',
'abbreviation' => 'Agnes Scott',
'unitid' => '138600',
'city' => 'Decatur', 'state' => 'GA',
'location' => "\0\0\0\0".''."\0\0\0".'p��R�U��)s��@@',
'governing_body' => 'NCAA', 'division' => '3',
'conference' => 'Great South',
'mascot' => null,
'created_at' => '2018-01-22T21:21:10.000000Z',
'updated_at' => '2019-03-27T19:01:11.000000Z',
'image' => 'https://d3on3ztz3vi4v9.cloudfront.net/images/colleges/138600/300/1551473956/138600.png',
'us_rank' => 73,
'us_rank_type' => 'National Liberal Arts', ]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment