Meine Idee ist, https Anfrage an alle URLs in meiner Datenbank gespeichert mit einem Modell namens Notifications
senden.laravel: http Anfrage gab Fehler
class guzzleController extends Controller
{
public function guzzle() {
$client = new Client();
$notes=Notification::all();
$response = $client->get($notes);
$response=$response->getStatusCode();
var_dump($response);
}
}
Aus irgendeinem Grund die get-Methode String erwartet, und es gab mir eine Fehlermeldung:
InvalidArgumentException in functions.php line 62: URI must be a string or UriInterface
Wie kann ich dieses Problem beheben? Jeder mit einer besseren Idee?
das ist eigentlich meine Benachrichtigungsklasse
namespace App;
use App\Status;
use App\Notification;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
protected $fillable = ['id','website_url','email','slack_channel','check_frequency','alert_frequency','speed_frequency','active'];
public function statuses(){
return $this->belongsToMany('App\Status')->withPivot('values')->withTimestamps();
}
Namensraum App; Verwenden Sie App \ Status; Verwenden Sie App \ Notification; verwenden Illuminate \ Database \ Eloquent \ Model; Klasse Mitteilung erstreckt Modell { \t protected $ ausfüllbare = [ 'id', 'WEBSITE_URL', 'E-Mail', 'slack_channel', 'check_frequency', 'alert_frequency', 'speed_frequency', 'aktiv']; \t public function Status() { \t \t return $ this-> belongsToMany ('App \-Status') -> withPivot ('Werte') -> withTimestamps(); \t} –
Sie sollten Ihre Frage aktualisieren, anstatt den Code als Kommentar hier zu veröffentlichen. –
Ich habe es hochgeladen! die neuen Codes sehen so aus –