Facade code:
<?php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
class ProfilePrivacy extends Facade
{
protected static function getFacadeAccessor()
{
return 'profileprivacy';
}
}
?>
helper code
<?php
namespace App\Helper;
// Server file
use App\Http\Models\Privacy as PrivacyModel;
class ProfilePrivacy
{
private $_model;
public function __construct()
{
$this->_model = new PrivacyModel();
}
private function get_by_id($id)
{
$result=$this->_model->get_by_id($id);
}
private function get_by_contact($id)
{
$result=$this->_model->get_by_contact($id);
}
private function user_profileimage_privacy($id)
{
$result=$this->_model->user_profileimage_privacy($id);
}
}
?>
Provider
<?php
namespace App\Providers;
use App\Helper\ProfilePrivacy;
use Queue;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Log;
class ProfilePrivacyServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
Queue::failing(function ($event) {
});
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind('profileprivacy', function () {
return new ProfilePrivacy;
});
}
}
app.php
$app->register(App\Providers\ProfilePrivacyServiceProvider::class);
WebRoute
$app->get('democlass', function(){
$imagepath = \App\Facades\ProfilePrivacy::get_by_contact('test');
print_r($imagepath);
});
i got the error Fatal error: Call to private method App\Helper\ProfilePrivacy::get_by_contact() from context 'Illuminate\Support\Facades\Facade' in C:\xampp\htdocs\voip_api\api\vendor\illuminate\support\Facades\Facade.php on line 221 Where i am doing mistake please overview the code