4 years ago

PHPStorm thinks Model::where doesn't exist on Model? [L5]

Posted 4 years ago by mhopkins321

This is most likely just an issue with L5 still being alpha. However Phpstorm is trying to tell me that where isn't on my model. I know for a fact phpstorm is wrong (to some degree at least) because the code functions and the where works. Some code is below. I also have installed (and ran) barry's ide-helper

    <?php namespace Idop\Http\Controllers;

    use Carbon\Carbon;
    use DB;
    use Idop\Http\Requests;
    use Idop\Message;
    use Slack;

    class SentimentController extends Controller {
        private function happy(){
            return Message::where('created_at','>',Carbon::today()->subDays(7))->where('average','>',0)->groupBy('user')->orderBy('average','desc')->get([DB::raw('user'), DB::raw('AVG(score) as average')])->limit(5);

    <?php namespace Idop;

    use Illuminate\Database\Eloquent\Model;

    class Message extends Model {

         * The database table used by the model.
         * @var string
        protected $table = 'messages';

         * The attributes that are mass assignable.
         * @var array
        protected $fillable = ['user', 'message', 'room','sentiment','score'];

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