Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Containers\Blog\Models;
- use App\Ship\Parents\Models\Model;
- class Blog extends Model
- {
- // Use: $posts = Blog::search($s)->latest()->get();
- public function scopeSearch($query, $s)
- {
- return $query->where('title', 'like', '%'.$s.'%')
- ->orWhere('content', 'like', '%'.$s.'%');
- }
- }
Add Comment
Please, Sign In to add comment