Exemplo n.º 1
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     //Announcement
     Announcement::created(function ($announcement) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcement', 'reference_id' => $announcement->id]);
     });
     Announcement::updated(function ($announcement) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcement', 'reference_id' => $announcement->id]);
     });
     Announcement::deleted(function ($announcement) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcement', 'reference_id' => $announcement->id]);
     });
     //Announcementclassroom
     Announcementclassroom::created(function ($announcementclassroom) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementclassroom', 'reference_id' => $announcementclassroom->id]);
     });
     Announcementclassroom::updated(function ($announcementclassroom) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementclassroom', 'reference_id' => $announcementclassroom->id]);
     });
     Announcementclassroom::deleted(function ($announcementclassroom) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementclassroom', 'reference_id' => $announcementclassroom->id]);
     });
     //AnnouncementFile
     AnnouncementFile::created(function ($announcementFile) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementFile', 'reference_id' => $announcementFile->id]);
     });
     AnnouncementFile::updated(function ($announcementFile) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementFile', 'reference_id' => $announcementFile->id]);
     });
     AnnouncementFile::deleted(function ($announcementFile) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementFile', 'reference_id' => $announcementFile->id]);
     });
     //Announcementspecialties
     Announcementspecialties::created(function ($announcementspecialties) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementspecialties', 'reference_id' => $announcementspecialties->id]);
     });
     Announcementspecialties::updated(function ($announcementspecialties) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementspecialties', 'reference_id' => $announcementspecialties->id]);
     });
     Announcementspecialties::deleted(function ($announcementspecialties) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementspecialties', 'reference_id' => $announcementspecialties->id]);
     });
     //Announcementstudent
     Announcementstudent::created(function ($announcementstudent) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementstudent', 'reference_id' => $announcementstudent->id]);
     });
     Announcementstudent::updated(function ($announcementstudent) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementstudent', 'reference_id' => $announcementstudent->id]);
     });
     Announcementstudent::deleted(function ($announcementstudent) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementstudent', 'reference_id' => $announcementstudent->id]);
     });
     //Announcementyear
     Announcementyear::created(function ($announcementyear) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementyear', 'reference_id' => $announcementyear->id]);
     });
     Announcementyear::updated(function ($announcementyear) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementyear', 'reference_id' => $announcementyear->id]);
     });
     Announcementyear::deleted(function ($announcementyear) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Announcements_announcementyear', 'reference_id' => $announcementyear->id]);
     });
 }
Exemplo n.º 2
0
 public function student($announcement_id)
 {
     $student_id = Student::pluck('username', 'id');
     $announcement = Announcement::with('students')->findOrFail($announcement_id);
     return view('announcements::student', compact('announcement', 'student_id'));
 }