Exemplo n.º 1
0
 public function deleteBulk(Request $request, ExamRules $rulesid)
 {
     // if the table_records is empty we redirect to the subject index
     if (!$request->has('table_records')) {
         return redirect()->route('exams.rules.index');
     }
     // we get all the ids and put them in a variable
     $ids = $request->input('table_records');
     // we delete all the subject with the ids $ids
     $rulesid->destroy($ids);
     // we redirect to the user index view with a success message
     return redirect()->route('exams.rules.index')->with('success');
 }
Exemplo n.º 2
0
 public function rules()
 {
     $rules = ExamRules::select('content', 'type')->where('state', 'نشط')->get();
     return $rules->groupBy('type');
 }
Exemplo n.º 3
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     //Exam
     Exam::created(function ($exam) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_exam', 'reference_id' => $exam->id]);
     });
     Exam::updated(function ($exam) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_exam', 'reference_id' => $exam->id]);
     });
     Exam::deleted(function ($exam) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_exam', 'reference_id' => $exam->id]);
     });
     //ExamCenter
     ExamCenter::created(function ($center) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_center', 'reference_id' => $center->id]);
     });
     ExamCenter::updated(function ($center) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_center', 'reference_id' => $center->id]);
     });
     ExamCenter::deleted(function ($center) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_center', 'reference_id' => $center->id]);
     });
     //ExamCenterPeriod
     ExamCenterPeriod::created(function ($period) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_period', 'reference_id' => $period->id]);
     });
     ExamCenterPeriod::updated(function ($period) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_period', 'reference_id' => $period->id]);
     });
     ExamCenterPeriod::deleted(function ($period) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_period', 'reference_id' => $period->id]);
     });
     //ExamQuestion
     ExamQuestion::created(function ($question) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_question', 'reference_id' => $question->id]);
     });
     ExamQuestion::updated(function ($question) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_question', 'reference_id' => $question->id]);
     });
     ExamQuestion::deleted(function ($question) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_question', 'reference_id' => $question->id]);
     });
     //ExamRecording
     ExamRecording::created(function ($recording) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_recording', 'reference_id' => $recording->id]);
     });
     ExamRecording::updated(function ($recording) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_recording', 'reference_id' => $recording->id]);
     });
     ExamRecording::deleted(function ($recording) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_recording', 'reference_id' => $recording->id]);
     });
     //ExamResult
     ExamResult::created(function ($result) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_result', 'reference_id' => $result->id]);
     });
     ExamResult::updated(function ($result) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_result', 'reference_id' => $result->id]);
     });
     ExamResult::deleted(function ($result) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_result', 'reference_id' => $result->id]);
     });
     //ExamResultAnswer
     ExamResultAnswer::created(function ($answer) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_answer', 'reference_id' => $answer->id]);
     });
     ExamResultAnswer::updated(function ($answer) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_answer', 'reference_id' => $answer->id]);
     });
     ExamResultAnswer::deleted(function ($answer) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_answer', 'reference_id' => $answer->id]);
     });
     //ExamRules
     ExamRules::created(function ($rule) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_rule', 'reference_id' => $rule->id]);
     });
     ExamRules::updated(function ($rule) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_rule', 'reference_id' => $rule->id]);
     });
     ExamRules::deleted(function ($rule) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_rule', 'reference_id' => $rule->id]);
     });
     //ExamExcuse
     ExamExcuse::created(function ($excuse) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_excuses', 'reference_id' => $excuse->id]);
     });
     ExamExcuse::updated(function ($excuse) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_excuses', 'reference_id' => $excuse->id]);
     });
     ExamExcuse::deleted(function ($excuse) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Exams_excuses', 'reference_id' => $excuse->id]);
     });
 }