3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Scholarship extends Model { protected $table = 'scholarships'; protected $primaryKey = 'scholarship_id'; public $incrementing = false; protected $keyType = 'string'; public $timestamps = false; protected $guarded = []; public function checklists() { return $this->hasMany(GuidanceChecklist::class, 'scholarship_id', 'scholarship_id'); } public function applications() { return $this->hasMany(StudentApplication::class, 'scholarship_id', 'scholarship_id'); } public static function calculateEligibility( Scholarship $scholarship, float $studentCgpa, ?string $studentField ): float { // Step 1: Calculate CGPA Score (70%) if ($scholarship->min_cgpa <= 0) { $cgpaScore = 70; } else { $cgpaScore = min( $studentCgpa / $scholarship->min_cgpa, 1 ) * 70; } // Step 2: Calculate Field of Study Score (30%) $scholarshipField = trim( (string) $scholarship->field_of_study ); $studentField = trim((string) $studentField); if ( $scholarshipField === '' || strtolower($scholarshipField) === 'open' || ( $studentField !== '' && strcasecmp($scholarshipField, $studentField) === 0 ) ) { $fieldScore = 30; } else { $fieldScore = 0; } // Step 3: Calculate Final Score $totalScore = $cgpaScore + $fieldScore; // Step 4: Return score between 0 and 100 return round( max(0, min($totalScore, 100)), 2 ); } }
Output for 8.2.0 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.13, 8.6.0
Fatal error: Uncaught Error: Class "Illuminate\Database\Eloquent\Model" not found in /in/Mpi74:7 Stack trace: #0 {main} thrown in /in/Mpi74 on line 7
Process exited with code 255.

preferences:
28.67 ms | 1164 KiB | 6 Q