I would like to exclude some rows by Eloquent [closed] - php

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 months ago.
Improve this question
I have a user table that contains a colum "role"
i would like to exclude the ones that contains a certain role by Eloquent
Does any one knows a solution for this ?

To answer your original comment
User::query()->whereNotIn('role', 'blabla')->get();
To answer the second edit of the comment:
User::query()->whereNotIn('role', [
'Admin', 'responsable', 'magasinier', 'demandeur'
])->get();
To answer the third edit of the comment:
User::query()->whereNotIn('role', 'demandeur')->get();

Related

Update of the foreign key to a null value [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
This query generates an error:
UPDATE sale
SET NumFacture='Null',
WHERE Code='22'
Where NumFacture is a foreign key in table sale so I can't update it with Null value. How can I do please!
Try without single quotes:
UPDATE sale
SET NumFacture=Null
WHERE Code='22'

Usage of FIND_IN_SET in query [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
$query=$this->db
->select(a.date,group_concat(s.name)
->from("tbl_attendance a,tbl_students s")
->WHERE ("FIND_IN_SET(s.student_id, a.attendance)")->group_by("a.date")
->get();
I wanted to know whether I have used the FIND_IN_SET and group_by functions correctly. Thanks in advance
FIND_IN_SET() returns the position of a string if it is present (as a
substring) within a list of strings
so you should search if a value is != 0
eg:
->where("FIND_IN_SET(s.student_id, a.attendance) !=", 0)
->group_by("a.date")

Laravel function name must be a string [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Laravel
What mistake am I actually doing?
Please have a look at the image below:
http://1drv.ms/1ybX4Cg
I think
$body['user_id'] = $user()->id;
should be
$body['user_id'] = $user->id;

How to rewrite URL in CakePHP [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am using Cake 2.3 and I have a URL like this:
http://www.example.com/events/event_name
I want to show
http://www.example.com/event_name
I have gone through many links but with no success I am posting here.
Please help me in this.
As mentioned in cakephp official documentation you can use Router class in your bootstrap.php file like
Router::redirect('/posts/*', 'http://google.com', array('status' => 302));

How to change role of subscriber to allow them to delete a post? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am using a front-end post editing and deleting option in my theme. Right now a subscriber cannot delete a post. How can I change the role of a subscriber to allow them to delete a post?
I have read this question here but did not get anything from it. Maybe some guidance on it will work for me.
Go to settings => General => New User Default Role
change user role from here

Categories