first commit
This commit is contained in:
27
app/Models/Enquiries.php
Normal file
27
app/Models/Enquiries.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Enquiries extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $primaryKey = 'enquiry_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'phone',
|
||||
'email',
|
||||
'enquiry_type',
|
||||
'message',
|
||||
'preparationclassoffers_id',
|
||||
];
|
||||
|
||||
public function class ()
|
||||
{
|
||||
return $this->belongsTo(Preparationclassoffers::class, 'preparationclassoffers_id');
|
||||
}
|
||||
}
|
36
app/Models/Log/ActivityLog.php
Normal file
36
app/Models/Log/ActivityLog.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Log;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ActivityLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
protected $primaryKey = 'activity_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'controllerName',
|
||||
'methodName',
|
||||
'actionUrl',
|
||||
'activity',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
];
|
||||
|
||||
|
||||
protected $appends = ['user_name'];
|
||||
|
||||
public function getUserNameAttribute()
|
||||
{
|
||||
$user = User::find($this->user_id);
|
||||
return $user ? $user->name : '';
|
||||
}
|
||||
}
|
31
app/Models/Log/ErrorLog.php
Normal file
31
app/Models/Log/ErrorLog.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Log;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ErrorLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'controller_name',
|
||||
'method_name',
|
||||
'errors',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
];
|
||||
|
||||
|
||||
protected $appends = [];
|
||||
|
||||
|
||||
}
|
37
app/Models/Log/LoginLog.php
Normal file
37
app/Models/Log/LoginLog.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Log;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LoginLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
protected $primaryKey = 'login_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'ip',
|
||||
'user_agent',
|
||||
'type',
|
||||
'login_at',
|
||||
'logout_at',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
];
|
||||
|
||||
|
||||
protected $appends = ['user_name'];
|
||||
|
||||
public function getUserNameAttribute()
|
||||
{
|
||||
$user = User::find($this->user_id);
|
||||
return $user ? $user->name : '';
|
||||
}
|
||||
}
|
40
app/Models/Log/OperationLog.php
Normal file
40
app/Models/Log/OperationLog.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Log;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OperationLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
protected $primaryKey = 'operation_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'refNo',
|
||||
'user_id',
|
||||
'operation_start_no',
|
||||
'operation_end_no',
|
||||
'model_name',
|
||||
'model_id',
|
||||
'operation_name',
|
||||
'previous_values',
|
||||
'new_values',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
];
|
||||
|
||||
|
||||
// protected $appends = ['operation_by'];
|
||||
|
||||
// public function getOperationByAttribute()
|
||||
// {
|
||||
// $user = User::find($this->user_id);
|
||||
// return $user ? $user->name : '';
|
||||
// }
|
||||
}
|
71
app/Models/Menuitems.php
Normal file
71
app/Models/Menuitems.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\CreatedUpdatedBy;
|
||||
|
||||
class Menuitems extends Model
|
||||
{
|
||||
use HasFactory, CreatedUpdatedBy;
|
||||
|
||||
protected $primaryKey = 'menu_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'parent_menu',
|
||||
'menulocations_id',
|
||||
'title',
|
||||
'alias',
|
||||
'type',
|
||||
'ref',
|
||||
'target',
|
||||
'display_order',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'createdby',
|
||||
'updatedby',
|
||||
|
||||
];
|
||||
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
protected function getStatusNameAttribute()
|
||||
{
|
||||
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||
}
|
||||
|
||||
protected function createdBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
|
||||
protected function updatedBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(Menuitems::class, 'parent_menu')->where('status', 1);
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(Menuitems::class, 'parent_menu')->orderBy('display_order')->where('status', 1);
|
||||
}
|
||||
|
||||
public function subchildren()
|
||||
{
|
||||
return $this->hasMany(Menuitems::class, 'parent_menu')
|
||||
->where('status', 1)
|
||||
->orderBy('display_order')
|
||||
->with('children');
|
||||
}
|
||||
}
|
48
app/Models/Menulocations.php
Normal file
48
app/Models/Menulocations.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\CreatedUpdatedBy;
|
||||
|
||||
class Menulocations extends Model
|
||||
{
|
||||
use HasFactory, CreatedUpdatedBy;
|
||||
|
||||
protected $primaryKey = 'menulocation_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable =[
|
||||
'title',
|
||||
'alias',
|
||||
'display_order',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'createdby',
|
||||
'updatedby',
|
||||
|
||||
];
|
||||
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
protected function getStatusNameAttribute()
|
||||
{
|
||||
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||
}
|
||||
|
||||
protected function createdBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
|
||||
protected function updatedBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
}
|
80
app/Models/Settings.php
Normal file
80
app/Models/Settings.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\CreatedUpdatedBy;
|
||||
|
||||
class Settings extends Model
|
||||
{
|
||||
use HasFactory, CreatedUpdatedBy;
|
||||
|
||||
protected $primaryKey = 'setting_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'description',
|
||||
'url1',
|
||||
'url2',
|
||||
'email',
|
||||
'location',
|
||||
'phone',
|
||||
'secondary_phone',
|
||||
'google_map',
|
||||
'fb',
|
||||
'insta',
|
||||
'twitter',
|
||||
'tiktok',
|
||||
'youtube',
|
||||
'working_days',
|
||||
'working_hours',
|
||||
'leave_days',
|
||||
'primary_logo',
|
||||
'secondary_logo',
|
||||
'thumb',
|
||||
'icon',
|
||||
'og_image',
|
||||
'no_image',
|
||||
'copyright_text',
|
||||
'content1',
|
||||
'content2',
|
||||
'content3',
|
||||
'seo_title',
|
||||
'seo_description',
|
||||
'seo_keywords',
|
||||
'og_tags',
|
||||
'display_order',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'createdby',
|
||||
'updatedby',
|
||||
'recaptcha_secret_key',
|
||||
'recaptcha_site_key'
|
||||
|
||||
];
|
||||
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
protected function getStatusNameAttribute()
|
||||
{
|
||||
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||
}
|
||||
|
||||
protected function createdBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
|
||||
protected function updatedBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
}
|
50
app/Models/Shortcodes.php
Normal file
50
app/Models/Shortcodes.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\CreatedUpdatedBy;
|
||||
|
||||
class Shortcodes extends Model
|
||||
{
|
||||
use HasFactory, CreatedUpdatedBy;
|
||||
|
||||
protected $primaryKey = 'shortcode_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable =[
|
||||
'title',
|
||||
'alias',
|
||||
'text',
|
||||
'description',
|
||||
'display_order',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'createdby',
|
||||
'updatedby',
|
||||
|
||||
];
|
||||
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
protected function getStatusNameAttribute()
|
||||
{
|
||||
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||
}
|
||||
|
||||
protected function createdBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
|
||||
protected function updatedBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
}
|
53
app/Models/Sitemenus.php
Normal file
53
app/Models/Sitemenus.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\CreatedUpdatedBy;
|
||||
|
||||
class Sitemenus extends Model
|
||||
{
|
||||
use HasFactory, CreatedUpdatedBy;
|
||||
|
||||
protected $primaryKey = 'menu_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable =[
|
||||
'parent_menu',
|
||||
'menulocations_id',
|
||||
'title',
|
||||
'alias',
|
||||
'type',
|
||||
'ref',
|
||||
'target',
|
||||
'display_order',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'createdby',
|
||||
'updatedby',
|
||||
|
||||
];
|
||||
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
protected function getStatusNameAttribute()
|
||||
{
|
||||
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||
}
|
||||
|
||||
protected function createdBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
|
||||
protected function updatedBy(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||
);
|
||||
}
|
||||
}
|
46
app/Models/User.php
Normal file
46
app/Models/User.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'username',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user