cybercog / laravel-eloquent-flag

Laravel Eloquent boolean & timestamp flagged attributes behavior.
https://komarev.com/sources/laravel-eloquent-flag
MIT License
133 stars 21 forks source link

[question] what i do here wrong #66

Closed Sivanwol closed 4 years ago

Sivanwol commented 4 years ago

i got a model that look like this `<?php

namespace App;

use Cog\Flag\Traits\Classic\HasApprovedFlag; use Cog\Flag\Traits\Classic\HasPublishedFlag; use Illuminate\Database\Eloquent\Model;

class Books extends Model { use HasApprovedFlag, HasPublishedFlag; /**

and controller method index that work like this public function index(Request $request) { $show_publish = ($request->query('show_publish', '0') != '1') ? false : true; $show_approved = ($request->query('show_approved', '0') != '1') ? false : true; $books = ($show_publish) ? Books::WithNotPublished() : Books::WithoutNotPublished(); //$books = ($show_approved) ? $response = $this->processResponse($books->get()); return $response->success(); }

my issue is this i get this error BadMethodCallException Call to undefined method App\Books::WithoutNotPublished() http://backend.booksurf.local/api/books Hide solutions Bad Method Call Did you mean App\Books::isNotPublished() ?

what do i do wrong what i did miss readed?