first commit

This commit is contained in:
2025-11-04 16:23:40 +05:00
commit 6486a35c03
4772 changed files with 506723 additions and 0 deletions

10
app/Models/Backup.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Backup extends Model
{
protected $guarded = [];
}

12
app/Models/Banner.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Banner extends Model
{
use HasFactory;
public $guarded=[];
}

15
app/Models/Category.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
use HasFactory;
public function courses(){
return $this->hasMany(Course::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CategoryNotes extends Model
{
protected $guarded = [];
}

42
app/Models/Course.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class Course extends Model
{
protected $guarded = [];
public $appends = [
'paid_amount'
];
public function category(){
return $this->belongsTo(Category::class);
}
public function user(){
return $this->belongsTo(User::class, 'student_id');
}
public function allTransactions(){
return $this->hasMany(Transaction::class);
}
public function creditTransactions(){
return $this->hasMany(Transaction::class)->where('type','CREDIT');
}
public function debitTransactions(){
return $this->hasMany(Transaction::class)->where('type','DEBIT');
}
protected function paidAmount(): Attribute
{
$creditAmount = $this->creditTransactions->sum('amount');
$debitAmount = $this->debitTransactions->sum('amount');
$total = $creditAmount - $debitAmount;
return Attribute::make(
get: fn ($value) => $total ,
);
}
}

11
app/Models/Game.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Game extends Model
{
use HasFactory;
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
use HasFactory;
}

11
app/Models/Setting.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
use HasFactory;
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Transaction extends Model
{
use HasFactory;
public function course(){
return $this->belongsTo(Course::class);
}
}

55
app/Models/User.php Normal file
View File

@@ -0,0 +1,55 @@
<?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',
// 'password',
// 'notification_id',
//
// ];
protected $guarded = [];
/**
* 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',
];
public function courses(){
return $this->hasMany(Course::class, 'student_id')->latest()->take(config('custom.HOME_RECORD_LIMIT'));
}
public function transactions(){
return $this->hasMany(Transaction::class, 'student_id')->latest()->take(config('custom.HOME_RECORD_LIMIT'));
}
}

14
app/Models/Video.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Video extends Model
{
public function videoCategory()
{
return $this->belongsTo(VideoCategory::class);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class VideoCategory extends Model
{
public function videos()
{
return $this->hasMany(Video::class);
}
}