I'm trying to do a query within a model, then call it in the url with
namespace App\Models;
use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Collection;
class TeachingPoint extends Model
{
use SoftDeletes;
protected $with = ['testRelation'];
public function testRelation()
{
$table = DB::table('test_table')->where(xxxx)->->get();
foreach($table as $data)
{
etc...
}
return $data;
}
I need to do it on the model, is this possible? Or I have to do it with "attribute" or in the controller itself
Thank you
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2qkd2Ku
via IFTTT
Aucun commentaire:
Enregistrer un commentaire