Level 4
Hi @Learner,
I'm also a newbie too, so may be I'm following your steps. What about to pass the table name as a parameter to the constructor, and, if set, override the protected $table?
I mean
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Gazett extends Model
{
/**
* The table's name
*
* @var string
*/
protected $table;
public function __constructor($table = 'gazett') {
$this->table = $table;
parent::__contructor();
}
}
so you do
$table = 'gazett_' . $input['ExamYear'] . '_' . $input['gender'] . '_' .$input['Examtype'];
$obj = new Gazett($table);