HEX
Server: Apache
System: Linux 162-241-121-228.webhostbox.net 3.10.0-862.3.2.el7.x86_64 #1 SMP Mon May 21 23:36:36 UTC 2018 x86_64
User: apiuattsproject (10003)
PHP: 8.2.31
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/uat-api.tsprojects.net/admin.plotterbox.tsprojects.net/app/Models/Books.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Observers\BookObserver;

class Books extends Model
{
    use HasFactory, SoftDeletes;

    /**
     * The table relationships name change from snake_case to camelCase.
     *
     * @var string
     */
    public static $snakeAttributes = false;

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'tblBooks';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'title',
        'totalPages',
        'bookThumbnail',
        'bookTitle',
        'bookPrice',
        'shortDescription',
        'reviewId',
        'ISBN',
        'publisherDate',
        'publisherId',
        'fileId',
        'sku',
        'category',
        'aboutBook',
        'display',
        'previewIdOne',
        'previewIdTwo',
        'previewIdThree',
    ];

    protected static function boot()
    {
        parent::boot();

        static::observe(BookObserver::class);
    }


    /**
     * Get the tblFiles data.
     */
    public function fileData()
    {
        return $this->belongsTo(Files::class, 'fileId', 'id');
    }

    /**
     * Get the tblFiles data.
     */
    public function previewOne()
    {
        return $this->belongsTo(Files::class, 'previewIdOne', 'id');
    }

    /**
     * Get the tblFiles data.
     */
    public function previewTwo()
    {
        return $this->belongsTo(Files::class, 'previewIdTwo', 'id');
    }

    /**
     * Get the tblFiles data.
     */
    public function previewThree()
    {
        return $this->belongsTo(Files::class, 'previewIdThree', 'id');
    }

    /**
     * Get the tblBooksAuthor data.
     */
    public function booksAuthor()
    {
        return $this->hasOne(BooksAuthor::class, 'bookId', 'id');
    }

    public function booksArtist()
    {
        return $this->hasOne(BooksArtist::class, 'bookId', 'id');
    }

    public function booksAuthors()
    {
        return $this->hasMany(BooksAuthor::class, 'bookId', 'id');
    }
    public function booksArtists()
    {
        return $this->hasMany(BooksAuthor::class, 'bookId', 'id');
    }


    /**
     * Get the tblBooksGenre data.
     */
    public function booksGenre()
    {
        return $this->hasOne(BooksGenre::class, 'bookId', 'id');
    }

    /**
     * Get the tblBookDetails data.
     */
    public function bookDetail()
    {
        return $this->hasOne(BookDetail::class, 'bookId', 'id');
    }

    /**
     * Get the tblBookReview data.
     */
    public function bookReview()
    {
        return $this->hasMany(BookReview::class, 'bookId', 'id');
    }

    /**
     * Get the tblBookRatings data.
     */
    public function bookRating()
    {
        return $this->hasMany(BookRating::class, 'bookId', 'id');
    }

    /**
     * Get the tblPublisher data.
     */
    public function bookPublisher()
    {
        return $this->belongsTo(Publisher::class, 'publisherId', 'id');
    }
}