/**
* Get query source of dataTable.
* @param Invoice $model
* @return \Illuminate\Database\Eloquent\Builder|static
*/
public function query(Invoice $model)
{
return $model->myInvoices()->newQuery();
}
and in the model you add
public function scopeMyInvoices($query)
{
return $query->where('user_id', user()->id);
}
Thanks! It works, but now my Admin and SuperUser can not view all records. I made this:
1) On DataTables/QuestionsDataTable.php
(…)
use Corals\User\Models\User;
use Corals\User\Models\Role;
/**
* Get query source of dataTable.
* @param Question $model
* @return \Illuminate\Database\Eloquent\Builder|static
*/
public function query(Question $model) {
return $model->Questions()->newQuery();
}
(…)
2) On Models/Question.php
(…)
use Corals\User\Models\User;
use Corals\User\Models\Role;
public function scopeQuestions($query) {
return $query->where(‘created_by’, user()->id);
}
(…)
My Admin and SuperUser can not view all records! What can I do?
For conditional role I use this inside my Model:
[code]
public function scopeQuestions($query) {
if (user()->hasRole(‘member’)) {
$permission = $query->where(‘created_by’, user()->id);
} else {
$permission = $query;
}
return $permission;
}
[/code]
Hello,
You need to get an extended license for questions related to the custom development, we have already answered many of your questions, but we cannot get go any further
I’m sorry. Am I not entitled to use this forum to ask questions? As I understand it, I have the right to technical support here about plataform system in this communication channel. If I got it wrong, beforehand, I apologize.
Hello,
Customization Consultation is not part of standard license support, it clearly mentioned in the license types
of course, you can ask questions about existing features on this forum
Ok, I got it. Sorry about that! So, how many cost this Customization Consultation and where I find it?
You need to have extended or multitenant license to be able to ask customization questions
Please, can you at least answer the questions I asked today? This one here has already been resolved, but I have two more that I sent. Can you help me with this, please !?
Please login or Register to submit your answer