Filter data from DB.

Posted 6 months ago by ziben69

Hello guys,

my question is about laravel, eloquent filtering. I have table which have got records: id, firstname, lastname, email.

I know how to display all informations from table, but how can I modify it to this:

Display all e-mails that don't contain firstname and lastname. Something like this:

Table: personal_data firstname lastname email john doe [email protected] dennis rat [email protected] mia donut [email protected]

and i need to have result:

Result: [email protected]

rest of data to the trash. Can someone help me?

public function index(MailRepository $mailRepo)
        $mails = $mailRepo->getAll();
        return view('mails.list', [
            "mailList" => $mails

protected $model;

    public function getAll($columns = array('*'))
        return $this->model->get($columns);

~~~ Mail model:
protected $fillable = [
        'FirstName', 'LastName', 'Email',

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.