I have a User Model as:
<?php
namespace App;
use App\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Notification;
use Illuminate\Notifications\RoutesNotifications;
use Notifications\EmailClientOfAccount;
class User3 extends User
{
use Notifiable;
public $emailList;
protected $fillable = [
'name', 'email',
];
public function __construct($emails)
{
$this->emailList = $emails;
}
public function getEmailList()
{
return $this->emailList;
}
public static function all(array $columns=[])
{
return $emailList;
}
public function routeNotificationForMail($notification)
{
return $this->email;
}
}
Then,and in Controller:
$collection = collect([
[ 'name' => 'user1', 'email' => 'user1@gmail.com', ], [ 'name' => 'user2',
'email' => 'user2@gmail.com', ], [ 'name' => 'user1000', 'email' =>
'user1000@gmail.com', ],
]);
Second Stage: $u4 = new User3($collection); when I use :
dd($u4::all());
It show below error: ErrorException: Declaration of App\User3::all(array $columns = Array) should be compatible with Illuminate\Database\Eloquent\Model::all($columns = Array)
I very try for solve it, but dont, very Thanks for any help to me,
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire