Method IlluminateDatabaseEloquentCollection::appends() not found error in Laravel Blade view

for a laravel project, in the dashboard I have several pages (services, products, projects, clients….etc) services it has the cruds of services and projects has the cruds of projects and so on).
In some pages I have this error:

Method IlluminateDatabaseEloquentCollection::appends does not exist. (View: C:laragonwwwnewdashboardresourcesviewsadminservicesindex.blade.php

while this page works correctly despite the fact that they have the same code.

Here is an example of a page that does not work:
ServiceController :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><?php
namespace AppHttpControllersAdmin;
use AppHttpControllersController;
use IlluminateHttpRequest;
use AppModelsService;
use InterventionImageFacadesImage;
class ServiceController extends Controller
{
public function index(Request $request)
{
$filter = $request->get('search_input');
$services = Service::search($filter)->paginate(20);
//$types = Type::get();
//dd($clients);
return view('admin.services.index', compact('services', 'filter'));
}
</code>
<code><?php namespace AppHttpControllersAdmin; use AppHttpControllersController; use IlluminateHttpRequest; use AppModelsService; use InterventionImageFacadesImage; class ServiceController extends Controller { public function index(Request $request) { $filter = $request->get('search_input'); $services = Service::search($filter)->paginate(20); //$types = Type::get(); //dd($clients); return view('admin.services.index', compact('services', 'filter')); } </code>
<?php

namespace AppHttpControllersAdmin;

use AppHttpControllersController;
use IlluminateHttpRequest;
use AppModelsService;
use InterventionImageFacadesImage;

class ServiceController extends Controller
{
    public function index(Request $request)
    {
        $filter = $request->get('search_input');
        $services = Service::search($filter)->paginate(20);
        //$types = Type::get();
        //dd($clients);
        return view('admin.services.index', compact('services', 'filter'));
    }

Models/Service.php :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>class Service extends Model
{
use HasFactory;
protected $fillable = [
'name',
'subtitle',
'description',
'image'
];
public function scopeSearch($query, $filter)
{
return $query->where('name', 'like', '%' . $filter . '%');
}
}
</code>
<code>class Service extends Model { use HasFactory; protected $fillable = [ 'name', 'subtitle', 'description', 'image' ]; public function scopeSearch($query, $filter) { return $query->where('name', 'like', '%' . $filter . '%'); } } </code>
class Service extends Model
{
    use HasFactory;
    protected $fillable = [
        'name',
        'subtitle',
        'description',
        'image'
        
    ];

    public function scopeSearch($query, $filter)
    {
        return $query->where('name', 'like', '%' . $filter . '%');
    }
}

in the view I have a table with a foreach and at the bottom:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><div class="card-footer with-pagination">
{{ $services->appends(['filter' => $filter])->links('vendor.pagination.bulma') }}
</div>
</code>
<code><div class="card-footer with-pagination"> {{ $services->appends(['filter' => $filter])->links('vendor.pagination.bulma') }} </div> </code>
<div class="card-footer with-pagination">
      {{ $services->appends(['filter' => $filter])->links('vendor.pagination.bulma') }}
    </div>

and here is the code for a page that works correctly:
PortfolioController.php :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><?php
namespace AppHttpControllersAdmin;
use AppHttpControllersController;
use IlluminateHttpRequest;
use AppModelsPortfolio;
use InterventionImageFacadesImage;
class PortfolioController extends Controller
{
public function index(Request $request)
{
$filter = $request->get('search_input');
$projects = Portfolio::search($filter)->paginate(20);
//$types = Type::get();
//dd($clients);
return view('admin.projects.index', compact('projects', 'filter'));
}
</code>
<code><?php namespace AppHttpControllersAdmin; use AppHttpControllersController; use IlluminateHttpRequest; use AppModelsPortfolio; use InterventionImageFacadesImage; class PortfolioController extends Controller { public function index(Request $request) { $filter = $request->get('search_input'); $projects = Portfolio::search($filter)->paginate(20); //$types = Type::get(); //dd($clients); return view('admin.projects.index', compact('projects', 'filter')); } </code>
<?php

namespace AppHttpControllersAdmin;

use AppHttpControllersController;
use IlluminateHttpRequest;
use AppModelsPortfolio;
use InterventionImageFacadesImage;

class PortfolioController extends Controller
{
    public function index(Request $request)
    {
        $filter = $request->get('search_input');
        $projects = Portfolio::search($filter)->paginate(20);
        //$types = Type::get();
        //dd($clients);
        return view('admin.projects.index', compact('projects', 'filter'));
    }

Models/Portfolio.php:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><?php
namespace AppModels;
use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;
class Portfolio extends Model
{
use HasFactory;
protected $fillable = [
'name',
'short_desc',
'desc',
'image',
'cat_id',
'additional',
'faq',
];
public function scopeSearch($query, $filter)
{
return $query->where('name', 'like', '%' . $filter . '%');
}
}
</code>
<code><?php namespace AppModels; use IlluminateDatabaseEloquentFactoriesHasFactory; use IlluminateDatabaseEloquentModel; class Portfolio extends Model { use HasFactory; protected $fillable = [ 'name', 'short_desc', 'desc', 'image', 'cat_id', 'additional', 'faq', ]; public function scopeSearch($query, $filter) { return $query->where('name', 'like', '%' . $filter . '%'); } } </code>
<?php

namespace AppModels;

use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;

class Portfolio extends Model
{
    use HasFactory;
    protected $fillable = [
        'name',
        'short_desc',
        'desc',
        'image',
        'cat_id',
        'additional',
        'faq',
        
    ];

    public function scopeSearch($query, $filter)
    {
        return $query->where('name', 'like', '%' . $filter . '%');
    }
}

and in the view the same a table with foreach and at the bottom:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> <div class="card-footer with-pagination">
{{ $projects->appends(['filter' => $filter])->links('vendor.pagination.bulma') }}
</div>
</code>
<code> <div class="card-footer with-pagination"> {{ $projects->appends(['filter' => $filter])->links('vendor.pagination.bulma') }} </div> </code>
    <div class="card-footer with-pagination">
      {{ $projects->appends(['filter' => $filter])->links('vendor.pagination.bulma') }}
    </div>

can anyone help me correct the error? any way, even if I have to change the code completely. or help me find where the error is coming from.

I tried to import classes such as:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>use IlluminateDatabaseEloquentCollection;
use IlluminatePaginationPaginator;
</code>
<code>use IlluminateDatabaseEloquentCollection; use IlluminatePaginationPaginator; </code>
use IlluminateDatabaseEloquentCollection;
use IlluminatePaginationPaginator;

and other classes too and I tried in the view links instead of appends:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>{{ $technologies->links() }}
</code>
<code>{{ $technologies->links() }} </code>
{{ $technologies->links() }}

but I don’t think that’s the problem. because in the other pages it works without changing anything. it’s too weird.

New contributor

Yakoub Fergag is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật