KalimeroMK
2 months ago
679
5
Laravel

(T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

Posted 2 months ago by KalimeroMK

I have created a trait to clean all cache on model events by this error pops up syntax error, unexpected 'ResponseCacheRepository' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

my code


<?php

namespace App\Traits;


use Artisan;

trait ClearsCache
{
    public static function bootClearsCache()
    {
        self::created(function () {
            Artisan::call('cache:clear');
        });

        self::updated(function () {
            Artisan::call('cache:clear');
        });

        self::deleted(function () {
            Artisan::call('cache:clear');
        });
    }
}

Please sign in or create an account to participate in this conversation.