Answer the question
In order to leave comments, you need to log in
Why are query builder methods not available for Eloquent models?
Hello! There is a model:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* @property integer $unid
* @property integer $userid
* @property integer $domain
* @property string $host
* @property string $type
* @property string $content
* @property integer $priority
* @property integer $weight
* @property integer $proto
* @property integer $port
* @property integer $target
*/
class DNS extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'dns';
protected $primaryKey = 'unid';
/**
* @var array
*/
protected $fillable = ['userid', 'domain', 'host', 'type', 'content', 'priority', 'weight', 'proto', 'port', 'target'];
}
namespace App\Http\Controllers;
require '../vendor/autoload.php';
use App\DNS;
class DNSController extends Controller
{
//тут какой-то код
....
//а тут я пытаюсь использовать методы из конструктора запросов в модели
public function CheckRecord ($userid,$id) {
$check = new DNS();
$check->where('unid',1);
if (isset($check->content)) {return true;}
else {return false;}
}
...
}
Answer the question
In order to leave comments, you need to log in
These are all facades and magic methods, install https://github.com/barryvdh/laravel-ide-helper
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question