0

$table->unsignedBigInteger('creater_id')->nullable();
$table->string('creater_type')->nullable();
$table->unsignedBigInteger('updater_id')->nullable();
$table->string('updater_type')->nullable();
$table->unsignedBigInteger('deleter_id')->nullable();
$table->string('deleter_type')->nullable();
public function creater()
{
    return $this->morphTo();
}
public function updater()
{
    return $this->morphTo();
}
public function deleter()
{
    return $this->morphTo();
}


function dm(){
    return auth()->guard('dm')->user();
}
public function index(): View
    {
        $data['lams'] = LocalAreaManager::with('creater')->whereMorph('creater_type', get_class(dm()), 'creater_id')->latest()->get();
        return view('district_manager.lam_management.index', $data);
    }

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'morph' in 'where clause'

Give me an error :

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'morph' in 'where clause'

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Feb 6, 2024 at 10:46

1 Answer 1

0

i think you must use creatable and updatable and deletable instead creater and updater and deleter in your Model

for example in laravel documentation :

public function imageable(): MorphTo
{
    return $this->morphTo();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.