Undefined index. Call to undefined function

help to solve the problem, an error is displayed

Call to undefined function App\Http\Controllers\array_prepend() {"userId":14,"exception":"[object] (Error(code: 0): Call to undefined function App\\Http\\Controllers\\array_prepend() at /var/www/html/app/Http/Controllers/AdminController.php:29)

` public static function log($type, $data, $user_id = null) {

    if($user_id == null && Auth::guest()) return;

    $json = json_decode(file_get_contents(storage_path().'/actions.json'), true);

    $json = array_prepend($json, array(

        "id" => $user_id == null ? Auth::user()->id : $user_id,

        "type" => $type,

        "time" => time(),

        "data" => $data

    ));
    file_put_contents(storage_path().'/actions.json', json_encode($json));
}`

second error

Undefined index: disabled {"userId":1,"exception":"[object] (ErrorException(code: 0):

the code itself

  public static function toggleDisabled($pull) {
    $json = json_decode(file_get_contents(storage_path().'/disabled.json'), true);
    if(in_array($pull, $json['disabled'])) array_push($json['disabled'], $pull);
    else unset($json['disabled'][array_search($pull, $json['disabled'])]);
    file_put_contents(storage_path().'/disabled.json', json_encode($json));
    return true;
}

Ответы (0 шт):