Non-static method Stevebauman Purify clean()

585 views Asked by At

Non-static method Stevebauman\Purify\Purify::clean() should not be called statically

Inside the class store:

$req = Purify::clean($request-\>except('\_token', '\_method'));

enter image description here

 public function store(Request $request)
 {
        $req = Purify::clean($request->except('_token', '_method'));
        $rules = ['category_title' => 'required',
            'category_description' => 'nullable',
            'image' => ['nullable', 'image', new FileTypeValidate(['jpeg', 'jpg', 'png'])]
        ];

        $validator = Validator::make($request->all(), $rules);
        if ($validator->fails()) {
            return back()->withErrors($validator)->withInput();
        }
 }
1

There are 1 answers

0
John Lobo On

import facade class like below

use Stevebauman\Purify\Facades\Purify

not

use Stevebauman\Purify\Purify

Also

Are you caching your configuration files? Try running php artisan config:clear and try again.

It looks like your application isn't loading the service provider, or isn't auto-loading the purify classes.

Ref:Class purify does not exist | Non-static method Stevebauman\Purify\Purify::clean() should not be called statically #9