Berdaq nomidagi qoraqalpoq davlat universiteti matematika fakulteti




Download 2,35 Mb.
bet13/15
Sana18.05.2024
Hajmi2,35 Mb.
#242014
1   ...   7   8   9   10   11   12   13   14   15
Bog'liq
Dars jadvalini yaratish online platformasi

SUBJECTS bosilsa,


Models/Subject.php




namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Subject extends Model
{
use HasFactory;
protected $guarded = [
'id'
];
}
Controllers/Subject Controller.php


namespace App\Http\Controllers;
use App\Models\Subject;
use App\Http\Requests\StoreSubjectRequest;
use App\Http\Requests\UpdateSubjectRequest;
class SubjectController extends Controller
{
public function index()
{
$subjects = Subject::get();
return view('admin.subjects', ['subjects' => $subjects]);
}
public function store(StoreSubjectRequest $request)
{
Subject::create($request->validated());
return back();
}
public function edit($id)
{
$subject = Subject::find($id);
return view('admin.subject_edit', ['subject' => $subject]);
}
public function update(UpdateSubjectRequest $request, $id)
{
Subject::find($id)->update($request->validated());
return redirect('subject');
}
public function destroy($id)
{
Subject::destroy($id);
return back(); } }
RESULTS bosilsa,

EVALUATION bosilsa,

EVALUATUION bosilsa,

EDIT bosilsa,

Models/Result.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Result extends Model


{
use HasFactory;
protected $guarded = [
'id'
];
}

Controllers/ResultController.php


namespace App\Http\Controllers;
use App\Http\Requests\StoreAdminRequest;
use App\Models\Student;
use App\Http\Requests\StoreStudentRequest;
use App\Http\Requests\UpdateStudentRequest;
use App\Models\Result as ModelsResult;
use App\Models\Subject;
use GuzzleHttp\Psr7\Request;
use Illuminate\Http\Request as HttpRequest;
use LDAP\Result;
use PHPUnit\Framework\MockObject\Builder\Stub;
use function Symfony\Component\String\b;
class StudentController extends Controller
{
public function index()
{
$students = Student::all()->sortBy('fullname');
return view('admin.students', ['students' => $students]);
}
public function store(StoreStudentRequest $request)
{
Student::create($request->validated());
return back();
}
public function result(HttpRequest $request)
{
$request->validate([
'login' => 'required',
'password' => 'required'
]);
$student = Student::where('login', $request->login)->first();
$results = ModelsResult::get();
$subjects = Subject::get();
if(empty($student) OR $student->password != $request->password)
{
return back();
}
if($student->password == $request->password)
{
return view('index', [
'student' => $student,
'results' => $results,
'subjects' => $subjects
]);
}
}
public function edit($id)
{
$student = Student::find($id);
return view('admin.student_edit', ['student' => $student]);
}
public function update(UpdateStudentRequest $request, $id)
{
Student::find($id)->update($request->validated());
return redirect('student');
}
public function destroy($id)
{
Student::destroy($id);
return back();
}
}
Ta’lim muassasilarida o’quv jarayoni nazorati. Vedmost tizimin yaratish

Bu yerda student login va parolini terib o’z natiyjalarin ko’rishi mumkin.
Masalan:

Login parolni kiritamiz va natijani ko’rishimiz mumkin.
Masalan bu yerda login – Adilbayeva, paroli – Ulbosin.
Uning uchun StudentControllerga
public function result(HttpRequest $request)
{
$request->validate([
'login' => 'required',
'password' => 'required'
]);
$student = Student::where('login', $request->login)->first();
$results = ModelsResult::get();
$subjects = Subject::get();
if(empty($student) OR $student->password != $request->password)
{
return back();
}
if($student->password == $request->password)
{
return view('index', [
'student' => $student,
'results' => $results,
'subjects' => $subjects
]);
}
}

Student bu yerda barcha fanlardan olgan natijalarin ko’rishih mumkin.



Download 2,35 Mb.
1   ...   7   8   9   10   11   12   13   14   15




Download 2,35 Mb.

Bosh sahifa
Aloqalar

    Bosh sahifa



Berdaq nomidagi qoraqalpoq davlat universiteti matematika fakulteti

Download 2,35 Mb.