'updated_backend_queries'

parent 71980c9f
...@@ -3,34 +3,48 @@ ...@@ -3,34 +3,48 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="1a1b2fc9-e664-4b80-be31-181ccebefc6b" name="Default Changelist" comment=""> <list default="true" id="1a1b2fc9-e664-4b80-be31-181ccebefc6b" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/UI/.gitignore" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/.editorconfig" beforeDir="false" afterPath="$PROJECT_DIR$/Core/.editorconfig" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/UI/README.md" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/Core/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/babel.config.js" beforeDir="false" afterPath="$PROJECT_DIR$/UI/babel.config.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/.styleci.yml" beforeDir="false" afterPath="$PROJECT_DIR$/Core/.styleci.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/UI/package-lock.json" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/Core/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/UI/package.json" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Console/Kernel.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Console/Kernel.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/public/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/UI/public/index.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Events/Event.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Events/Event.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/App.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/App.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Events/ExampleEvent.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Events/ExampleEvent.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/components/HelloWorld.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/components/HelloWorld.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Exceptions/Handler.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Exceptions/Handler.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/config/config.js" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/config/config.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Http/Controllers/Controller.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Http/Controllers/Controller.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/main.js" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/main.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Http/Controllers/QuizController.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Http/Controllers/QuizController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/plugins/vuetify.js" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/plugins/vuetify.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Http/Controllers/StudentsController.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Http/Controllers/StudentsController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/router.js" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/router.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Http/Middleware/Authenticate.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Http/Middleware/Authenticate.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/sass/main.scss" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/sass/main.scss" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Http/Middleware/CorsMiddleware.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Http/Middleware/CorsMiddleware.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/services/api.service.js" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/services/api.service.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Http/Middleware/ExampleMiddleware.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Http/Middleware/ExampleMiddleware.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/services/config.js" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/services/config.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Http/Middleware/HttpsProtocol.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Http/Middleware/HttpsProtocol.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/services/jwt.service.js" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/services/jwt.service.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Jobs/ExampleJob.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Jobs/ExampleJob.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/layout/Base.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/layout/Base.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Jobs/Job.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Jobs/Job.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/layout/Footer.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/layout/Footer.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Listeners/ExampleListener.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Listeners/ExampleListener.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/layout/Header.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/layout/Header.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Models/Quiz.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Models/Quiz.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/layout/SideBar.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/layout/SideBar.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Models/Students.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Models/Students.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/pages/Activity.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/pages/Activity.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Models/User.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Models/User.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/pages/ActivityAnalytics.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/pages/ActivityAnalytics.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Providers/AppServiceProvider.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Providers/AppServiceProvider.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/pages/Dashboard.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/pages/Dashboard.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Providers/AuthServiceProvider.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Providers/AuthServiceProvider.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/pages/Login.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/pages/Login.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/app/Providers/EventServiceProvider.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/app/Providers/EventServiceProvider.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/pages/Reports.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/pages/Reports.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/artisan" beforeDir="false" afterPath="$PROJECT_DIR$/Core/artisan" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/pages/Student.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/pages/Student.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/bootstrap/app.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/bootstrap/app.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/src/view/pages/StudentProfile.vue" beforeDir="false" afterPath="$PROJECT_DIR$/UI/src/view/pages/StudentProfile.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/Core/composer.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UI/yarn.lock" beforeDir="false" afterPath="$PROJECT_DIR$/UI/yarn.lock" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Core/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Core/composer.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/database/factories/UserFactory.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/database/factories/UserFactory.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/database/inteljr (1).sql" beforeDir="false" afterPath="$PROJECT_DIR$/Core/database/inteljr (1).sql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/database/seeders/DatabaseSeeder.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/database/seeders/DatabaseSeeder.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/phpunit.xml" beforeDir="false" afterPath="$PROJECT_DIR$/Core/phpunit.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/public/.htaccess" beforeDir="false" afterPath="$PROJECT_DIR$/Core/public/.htaccess" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/public/index.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/public/index.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/routes/web.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/routes/web.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/storage/app/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/Core/storage/app/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/storage/framework/cache/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/Core/storage/framework/cache/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/storage/framework/cache/data/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/Core/storage/framework/cache/data/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/storage/framework/views/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/Core/storage/framework/views/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/storage/logs/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/Core/storage/logs/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/tests/ExampleTest.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/tests/ExampleTest.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Core/tests/TestCase.php" beforeDir="false" afterPath="$PROJECT_DIR$/Core/tests/TestCase.php" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -69,7 +83,7 @@ ...@@ -69,7 +83,7 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1613414107534</updated> <updated>1613414107534</updated>
<workItem from="1613414111905" duration="2105000" /> <workItem from="1613414111905" duration="2105000" />
<workItem from="1620655555354" duration="1293000" /> <workItem from="1620655555354" duration="1880000" />
</task> </task>
<servers /> <servers />
</component> </component>
......
<?php
namespace App\Http\Controllers;
use App\Models\Activity;
use App\Models\Feedback;
use App\Models\Admin;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class CommonController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//
}
public function getActivityCount() {
return response()->json( ['activityCount'=> Activity::count()] );
}
public function getCommentCount() {
return response()->json( ['commentCount'=> Feedback::count()] );
}
public function login(Request $request) {
$user = Admin::Where('username',$request->email)
->Where('password',$request->password)->first();
return response()->json( ['user'=> $user],200 );
}
public function getActivityChatData() {
$counts = DB::table('activities')
->select(DB::raw('count(student_id) as count, type'))
->groupBy('type')
->get();
return response()->json( ['counts' => $counts] );
}
}
...@@ -4,30 +4,62 @@ namespace App\Http\Controllers; ...@@ -4,30 +4,62 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\Quiz; use App\Models\Quiz;
use App\Models\QuizRecord;
use App\Models\ResultSummary;
use App\Models\ActivityMaster;
use App\Models\User;
use DB;
use Log;
class QuizController extends Controller { class QuizController extends Controller {
/** /**
* Get all students * Get all students
*/ */
public function get_all() { public function get_all() {
return response()->json( Quiz::get() ); try {
$quiz_records = QuizRecord::get() ;
return response()->json([ 'quiz_records' => $quiz_records], 200);
} catch ( \Exception $e ) {
Log::error( $e );
return response()->json( ['message' => $e->getmessage()], 500 );
}
} }
/** public function getActivityMaster() {
* Get student by id try {
*/ $data = ActivityMaster::get() ;
public function get_by_id( $id ) { return response()->json( $data, 200);
return response()->json( Quiz::find($id) ); } catch ( \Exception $e ) {
return response()->json( ['message' => $e->getmessage()], 500 );
}
} }
/** public function getActivityMasterById($id) {
* Get all students count try {
*/ $data = ActivityMaster::Where('activity_id',$id)->first();
public function get_count() { return response()->json( $data, 200);
return response()->json( Quiz::count() ); } catch ( \Exception $e ) {
return response()->json( ['message' => $e->getmessage()], 500 );
}
} }
// /**
// * Get all students count
// */
// public function get_count() {
// try {
// $quiz_counts = QuizRecord::count() ;
// return response()->json([ 'quiz_counts' => $quiz_counts], 200);
// } catch ( \Exception $e ) {
// Log::error( $e );
// return response()->json( ['message' => $e->getmessage()], 500 );
// }
// }
/** /**
* Get student by gender * Get student by gender
*/ */
...@@ -47,17 +79,42 @@ class QuizController extends Controller { ...@@ -47,17 +79,42 @@ class QuizController extends Controller {
public function get_players_count() { public function get_players_count() {
$players_count = 30; try {
return response()->json( $players_count ); $players_count = User::count() ;
return response()->json([ 'players_count' => $players_count], 200);
} catch ( \Exception $e ) {
Log::error( $e );
return response()->json( ['message' => $e->getmessage()], 500 );
}
} }
public function get_quiz_count() { public function get_quiz_count() {
$quiz_count = 20;
return response()->json( $quiz_count ); try {
$quiz_count = User::count() ;
return response()->json([ 'quiz_count' => $quiz_count], 200);
} catch ( \Exception $e ) {
Log::error( $e );
return response()->json( ['message' => $e->getmessage()], 500 );
}
} }
public function get_avg_time() { public function get_avg_time() {
$players_count = 45; try {
$QuizRecord = QuizRecord::get();
$QuizRecordCount = QuizRecord::count();
$duration = 0;
$avg_time = 0;
foreach ($QuizRecord as $item) {
$duration += $item->duration;
}
$avg_time = $duration/$QuizRecordCount;
return response()->json([ 'avg_time' => $avg_time], 200);
} catch ( \Exception $e ) {
Log::error( $e );
return response()->json( ['message' => $e->getmessage()], 500 );
}
return response()->json( $players_count ); return response()->json( $players_count );
} }
...@@ -87,7 +144,46 @@ class QuizController extends Controller { ...@@ -87,7 +144,46 @@ class QuizController extends Controller {
return response()->json( $difficult_quiz ); return response()->json( $difficult_quiz );
} }
public function getCompletedStudents($id) {
$count = DB::table('tbl_student')
->leftJoin('activities', 'tbl_student.student_id', '=', 'activities.student_id')
->select(DB::raw('count(activities.student_id)*100/count(tbl_student.student_id) as count'))
->Where('activities.activity_id',$id)
->first();
return response()->json( ['count'=>$count] );
}
public function getRankings($id) {
$ranking = DB::table('tbl_result_summary')
->select(DB::raw('count(student_id) as count, grade'))
->groupBy('grade')
->Where('activity_id',$id)
->get();
return response()->json( $ranking );
}
public function getLowStudents($id) {
$students = ResultSummary::with('info')
->Where('marks' ,'<=', '30')
->Where('activity_id',$id)
->get();
return response()->json( ['students' => $students] );
}
public function getDiffQuiz( $id ) {
try {
$quiz = DB::table('tbl_question')
->join('tbl_result', function($join)
{
$join->on('tbl_question.question_id', '=', 'tbl_result.question_id');
$join->on('tbl_result.user_answer', '!=', 'tbl_result.right_answer');
})
->select('tbl_question.*')
->Where('activity_id', $id)->distinct()->get();
return response()->json([ 'quiz' => $quiz], 200);
} catch ( \Exception $e ) {
return response()->json( ['message' => $e->getmessage()], 500 );
}
}
} }
...@@ -4,6 +4,10 @@ namespace App\Http\Controllers; ...@@ -4,6 +4,10 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\Students; use App\Models\Students;
use App\Models\Prediction;
use App\Models\ResultSummary;
use Illuminate\Support\Facades\DB;
class StudentsController extends Controller { class StudentsController extends Controller {
...@@ -11,14 +15,20 @@ class StudentsController extends Controller { ...@@ -11,14 +15,20 @@ class StudentsController extends Controller {
* Get all students * Get all students
*/ */
public function get_all() { public function get_all() {
return response()->json( Students::get() ); try {
$students = Students::all();
return response()->json([ 'students' => $students], 200);
} catch ( \Exception $e ) {
//Log::error( $e );
return response()->json( ['message' => $e->getmessage()], 500 );
}
} }
/** /**
* Get student by id * Get student by id
*/ */
public function get_by_id( $id ) { public function get_by_id( $id ) {
return response()->json( Students::find($id) ); return response()->json( Students::where('student_id' , $id)->first());
} }
/** /**
...@@ -45,28 +55,38 @@ class StudentsController extends Controller { ...@@ -45,28 +55,38 @@ class StudentsController extends Controller {
return response()->json( $Students ); return response()->json( $Students );
} }
public function get_attendance() { public function get_attendance($sId) {
$attendance = 84; $counts = DB::select(DB::raw('select count(attendanceid) as count from attendance where MONTH(date) = month(CURRENT_DATE) and student_id = '.$sId));
return response()->json( $attendance ); return response()->json($counts);
} }
public function get_works() { public function get_works($id) {
$works = 20; $works = ResultSummary::Where('student_id',$id)->orderByDesc('added_date')->first();
return response()->json( $works ); return response()->json( $works );
} }
public function get_last_performamce() { public function get_last_performamce($sId) {
$performance = [ // $performance = [
0 => [ // 0 => [
'subject' => 'English', // 'subject' => 'English',
'marks' => 80 // 'marks' => 80
], // ],
1 => [ // 1 => [
'subject' => 'ICT', // 'subject' => 'ICT',
'marks' => 90 // 'marks' => 90
], // ],
]; // ];
$performance = DB::table('activities')
->select(DB::raw('count(marks) as marks, type as subject'))
->groupBy('type')
->Where('student_id',$sId)
->get();
return response()->json( $performance ); return response()->json( $performance );
} }
public function getPredictedData( $id ) {
return response()->json( ['result' => Prediction::where('student_id' , $id)->get()]);
}
} }
...@@ -19,7 +19,7 @@ class CorsMiddleware ...@@ -19,7 +19,7 @@ class CorsMiddleware
$headers = [ $headers = [
'Access-Control-Allow-Methods' => 'POST,GET,OPTIONS,PUT,DELETE', 'Access-Control-Allow-Methods' => 'POST,GET,OPTIONS,PUT,DELETE',
'Access-Control-Allow-Headers' => 'Content-Type, X-Auth-Token, Origin, Authorization', 'Access-Control-Allow-Headers' => 'Content-Type, X-Auth-Token, Origin, Authorization',
]; ];
if ($request->getMethod() == "OPTIONS"){ if ($request->getMethod() == "OPTIONS"){
//The client-side application can set only headers allowed in Access-Control-Allow-Headers //The client-side application can set only headers allowed in Access-Control-Allow-Headers
return response()->json('OK',200,$headers); return response()->json('OK',200,$headers);
...@@ -31,4 +31,4 @@ class CorsMiddleware ...@@ -31,4 +31,4 @@ class CorsMiddleware
return $response; return $response;
} }
} }
\ No newline at end of file
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Activity extends Model {
protected $table = 'activities';
protected $fillable = [
'activity_id',
'student_id',
'level',
'type',
'content',
'date_time',
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ActivityMaster extends Model {
protected $table = 'activity_master';
protected $fillable = [
'activity_id',
'activity_title',
'subject',
'no_of_students',
'avg_time',
'no_of_quiz'
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Admin extends Model {
protected $table = 'admin';
protected $fillable = [
'id',
'username',
'password'
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Feedback extends Model {
protected $table = 'feedback';
protected $fillable = [
'name',
'parent_id',
'subject',
'feedback',
'date',
'time',
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class History extends Model {
protected $table = 'history';
protected $fillable = [
'username',
'eid',
'score',
'score',
'level',
'correct',
'wrong',
'date',
'timestamp',
'status',
'score_updated'
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Prediction extends Model {
protected $table = 'student_prediction';
protected $fillable = [
'student_id', 'actual', 'predicted'
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class QuizRecord extends Model {
protected $table = 'quizrecord';
protected $fillable = [
'recid',
'rollno',
'duration',
'endtime',
'date',
'url'
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ResultSummary extends Model {
protected $table = 'tbl_result_summary';
protected $fillable = [
'summary_id',
'student_id',
'marks',
'activity_id',
'grade',
'subject',
];
public $timestamps = false;
public function info()
{
return $this->belongsTo('App\Models\Students', 'student_id', 'student_id');
}
}
...@@ -6,15 +6,19 @@ use Illuminate\Database\Eloquent\Model; ...@@ -6,15 +6,19 @@ use Illuminate\Database\Eloquent\Model;
class Students extends Model { class Students extends Model {
protected $table = 'user'; protected $table = 'tbl_student';
protected $fillable = [ protected $fillable = [
'name', 'student_id',
'rollno', 'first_name',
'branch', 'last_name',
'gender', 'email',
'username', 'username',
'phno',
'password', 'password',
'contact',
'grade',
'is_active',
'added_date',
'updated_date',
]; ];
public $timestamps = false; public $timestamps = false;
} }
...@@ -19,7 +19,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac ...@@ -19,7 +19,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
* @var array * @var array
*/ */
protected $fillable = [ protected $fillable = [
'name', 'email', 'name', 'email', 'rollno', 'branch','gender','phno','username'
]; ];
/** /**
......
...@@ -73,12 +73,10 @@ $app->configure('app'); ...@@ -73,12 +73,10 @@ $app->configure('app');
*/ */
$app->middleware([ $app->middleware([
App\Http\Middleware\CorsPolicy::class, App\Http\Middleware\CorsMiddleware::class,
App\Http\Middleware\HttpsProtocol::class
]); ]);
// $app->routeMiddleware([
// 'auth' => App\Http\Middleware\Authenticate::class,
// ]);
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
......
...@@ -18,26 +18,41 @@ $router->get('/', function () use ($router) { ...@@ -18,26 +18,41 @@ $router->get('/', function () use ($router) {
}); });
$router->group(['prefix' => 'api' ], function () use ($router) { $router->group(['prefix' => 'api' ], function () use ($router) {
$router->post('login', 'CommonController@login');
//Students Master //Students Master
$router->group(['prefix' => 'students'], function () use ($router) { $router->group(['prefix' => 'students'], function () use ($router) {
$router->get('all', 'StudentsController@get_all'); $router->get('all', 'StudentsController@get_all');
$router->get('view/{id}', 'StudentsController@get_by_id'); $router->get('view/{id}', 'StudentsController@get_by_id');
$router->get('count', 'StudentsController@get_count'); $router->get('count', 'StudentsController@get_count');
$router->get('get-attendance', 'StudentsController@get_attendance'); $router->get('get-attendance/{sId}', 'StudentsController@get_attendance');
$router->get('get-works', 'StudentsController@get_works'); $router->get('get-works/{id}', 'StudentsController@get_works');
$router->get('get-last-performance', 'StudentsController@get_last_performamce'); $router->get('get-last-performance/{sId}', 'StudentsController@get_last_performamce');
$router->post('search', 'StudentsController@search'); $router->post('search', 'StudentsController@search');
$router->get('prediction/{id}', 'StudentsController@getPredictedData');
}); });
$router->group(['prefix' => 'quiz'], function () use ($router) { $router->group(['prefix' => 'quiz'], function () use ($router) {
$router->get('all', 'QuizController@get_all'); $router->get('all', 'QuizController@get_all');
$router->get('view/{id}', 'QuizController@get_by_id'); $router->get('view/{id}', 'QuizController@get_by_id');
$router->get('count', 'QuizController@get_count');
$router->get('get-players-count', 'QuizController@get_players_count'); $router->get('get-players-count', 'QuizController@get_players_count');
$router->get('get-quiz-count', 'QuizController@get_quiz_count'); $router->get('get-quiz-count', 'QuizController@get_quiz_count');
$router->get('get-avg-time', 'QuizController@get_avg_time'); $router->get('get-avg-time', 'QuizController@get_avg_time');
$router->get('help-needed-students', 'QuizController@help_needed_students'); $router->get('help-needed-students', 'QuizController@help_needed_students');
$router->get('difficult-quiz', 'QuizController@difficult_quiz'); $router->get('difficult-quiz', 'QuizController@difficult_quiz');
$router->get('activity-master', 'QuizController@getActivityMaster');
$router->get('activity-master/{id}', 'QuizController@getActivityMasterById');
$router->get('completed/{id}', 'QuizController@getCompletedStudents');
$router->get('rankings/{id}', 'QuizController@getRankings');
$router->get('lowStudents/{id}', 'QuizController@getLowStudents');
$router->get('diffquiz/{id}', 'QuizController@getDiffQuiz');
});
$router->group(['prefix' => 'common'], function () use ($router) {
$router->get('activities/count', 'CommonController@getActivityCount');
$router->get('comments/count', 'CommonController@getCommentCount');
$router->get('activity/chart', 'CommonController@getActivityChatData');
}); });
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment