How to pass custom table name in model?

We have to pass protected $table = 'YOUR TABLE NAME'; in your respective Model

This is one of the most asked laravel interview questions.



namespace App;

use Illuminate\Database\Eloquent\Model;

class Login extends Model
    protected $table = 'admin';
    static function logout() {  
        if(session()->flush() || session()->regenerate()) {
            return true;

Suggest An Answer

No suggestions avaliable!

Latest post from Laravel Interview Questions

Ask Question