Comments (4)
For instance doing app('App\Spam\Checker')
on the below should ideally resolve the depdency-injected Akismet class through laravel's IOC which will set the api details, but it doesn't because of the way it's bound in the service provider:
<?php namespace App\Spam;
use nickurt\Akismet\Akismet;
class Checker {
/**
* Spam checker.
*
* @var nickurt\Akismet\Akismet
*/
protected $checker;
/**
* Start spam checker.
*
* @param Akismet $checker
*/
public function __construct(Akismet $checker)
{
$this->checker = $checker;
}
/**
* Determine if given array of options is spam.
*
* @param array $data
* @return boolean
*/
public function isSpam(array $data)
{
if (!is_null($name = array_get($data, 'name')))
{
$this->checker->setCommentAuthor($name);
}
if (!is_null($email = array_get($data, 'email')))
{
$this->checker->setCommentAuthorEmail($email);
}
$this->checker->setCommentContent($data['message']);
return $this->checker->isSpam();
}
}
from laravel-akismet.
Can you do a Pull Request for this?
from laravel-akismet.
Ping @garygreen ?
from laravel-akismet.
Solved
from laravel-akismet.
Related Issues (12)
- Add tests ...
- Dependencies errors when trying to install HOT 3
- update/change phpunit tests to guzzle6 ... HOT 1
- validateKey function not exist HOT 1
- Bad PwnedPasswords include HOT 1
- Add 'is_test' for when you 'submitting test queries to Akismet'
- Tag HOT 1
- Release version for Laravel 10 HOT 2
- Refactor getResponseData HOT 1
- Null values issue HOT 8
- Throw exception on invalid API call
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-akismet.