I'm trying to update a value in a database in laravel4. It's a bit of a cornercase, I have just a single entry in the database with a session-id in it. it's used to authenticate against facebook.
This is the model:
<?php
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
class Accesstoken extends Eloquent {
public static function createpost($token)
{
$accesstoken = new Accesstoken;
$accesstoken->accesstoken = $token;
$accesstoken->save();
}
public static function update($token)
{
$accesstoken = Accesstoken::find(1);
$accesstoken->accesstoken = $token;
$accesstoken->save();
}
}
It's the second function that is wrong. If I try to add it before doing a migrate, I can't migrate and if I try to call it like this
Accesstoken::update($access_token);
I get the following error, why?
Cannot make non static method Illuminate\Database\Eloquent\Model::update() static in class Accesstoken
Eloquent\Modelalready implements a methodpublic function update(array $attributes = array())that isn't static.