JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr gilour

File "Campaigns.php"

Full Path: /home/sibcards/public_html/app/Models/Campaigns.php
File size: 1.1 KB
MIME-type: text/x-php
Charset: utf-8

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Campaigns extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'user',
        'cat_type',
        'business',
        'start_date',
        'end_date',
        'total_days',
        'status',
        'approval',
        'created_by'
    ];

    public function users()
    {
        return $this->hasOne('App\Models\User', 'id', 'user');
    }
    public function category()
    {
        return $this->hasOne('App\Models\BusinessCategory', 'id', 'cat_type');
    }

    // public function businesses()
    // {
    //     return $this->hasOne('App\Models\Business', 'id', 'business');
    // }

    public static $statuses = [
        0 => 'Pending',
        1 => 'Active',
        2 => 'Expired',
        3 => 'Declined'
    ];
    public static function promote($id)
    {
        return Promote::where('campaign', $id)->first();
    }

    public function businesses()
    {
        return $this->belongsToMany(Business::class, 'business');
    }
}