Reputation: 299
i'm trying to get all the column name in my database table but i always end up with this error,
My Controller:
public function gettable()
{
$points = new Point;
$columns=$points->getTableColumns('points');
dd($columns->all());
}
My Model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Point extends Model
{
protected $guarded = ['id', 'name'];
public function getTableColumns($table)
{
return Schema::getColumnListing($table);
}
}
Can anyone point me to a proper solution thanks..
Upvotes: 0
Views: 334
Reputation: 2328
There is a syntax error
you need to use single quote '
or double quote "
instead of an apostrophe ‘
replace this line with
From
protected $guarded = [‘id’, ‘name’];
To
protected $guarded = ['id', 'name'];
Upvotes: 1