예제 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($id)
 {
     $school = Schools::where('id', $id)->first();
     $articles = Articles::all()->where('user_id', $school->user_id);
     $data = array('school' => $school, 'articles' => $articles);
     return view('pages.profil', $data);
 }
예제 #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function banding()
 {
     $data = array();
     $cari1 = $_POST['cari1'];
     $cari2 = $_POST['cari2'];
     $sekolah1 = Schools::where('nama_sekolah', 'like', '%' . $cari1 . '%')->first();
     $sekolah2 = Schools::where('nama_sekolah', 'like', '%' . $cari2 . '%')->first();
     $data = array('cari1' => $cari1, 'cari2' => $cari2, 'sekolah1' => $sekolah1, 'sekolah2' => $sekolah2);
     return view('pages.bandingkan', $data);
 }
예제 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $data = array();
     $search = $request->input('search');
     $schools = Schools::where('nama_sekolah', 'like', '%' . $search . '%')->get();
     $articles = Articles::where('title', 'like', '%' . $search . '%')->where('category', 'news')->get();
     $activities = Articles::where('title', 'like', '%' . $search . '%')->where('category', 'activity')->get();
     $events = Events::where('title', 'like', '%' . $search . '%')->get();
     $total = $schools->count() + $articles->count() + $activities->count() + $events->count();
     $data = array('schools' => $schools, 'articles' => $articles, 'activities' => $activities, 'events' => $events, 'search' => $search, 'total' => $total);
     return view('pages.pencarian', $data);
 }
예제 #4
0
 public function delete($tipe, $id)
 {
     if ($tipe == 'event') {
         Events::where('id', $id)->delete();
         return redirect('dashboard/admin/events');
     } elseif ($tipe == 'article') {
         Articles::where('id', $id)->delete();
         $upload_folder = '/img/article/';
         unlink(public_path() . $upload_folder . $id . '.jpg');
         return redirect('dashboard/admin/articles');
     } elseif ($tipe == 'user') {
         $role = Users::where('id', $id);
         Users::where('id', $id)->delete();
         if ($role - role == 'sekolah') {
             Schools::where('user_id', $role->id)->delete();
         }
         return redirect('dashboard/admin/users');
     } elseif ($tipe == 'activity') {
         Articles::where('id', $id)->delete();
         return redirect('dashboard/admin/activities');
     }
 }
예제 #5
0
 public function information()
 {
     $user = Auth::user();
     $sekolah = Schools::where('user_id', $user->id)->first();
     $data = array('sekolah' => $sekolah);
     return view('sekolah.information', $data);
 }