mercredi 24 octobre 2018

How get string name of the model?

Some laravel plugins in tables keeps reference to some models like :

App\Vote

when the model is defined as app/Vote.php :

<?php

namespace App;

use DB;
use App\MyAppModel;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Validation\Rule;

class Vote extends MyAppModel
{
    use funcsTrait;
    use Sluggable;
    use HasTags;


    protected $table = 'votes';
    protected $primaryKey = 'id';
    public $timestamps = false;

I wonder which is the correct way to get "App\Vote" string from this model ?

Laravel 5.7.

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire