Exemplo n.º 1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //
     $posts = post::where('group_id', $id)->get();
     $group = group::find($id);
     $in = player_in_group::where('player_id', Auth::user()->id)->where('group_id', $id)->count();
     return view('player.group.group_index', ['group' => $group, 'posts' => $posts, 'in' => $in]);
 }
Exemplo n.º 2
0
 public function showpdf($slug)
 {
     $artikel = \App\post::where('slug', $slug)->first();
     if (!empty($artikel)) {
         $data = array('data' => $artikel);
         $pdf = \PDF::loadView('artikel.pdf', $data);
         return $pdf->stream();
         /*return $pdf->download($slug. 'pdf');*/
     } else {
         return redirect(url());
     }
 }
Exemplo n.º 3
0
 public function template($slug)
 {
     $restaurant = template::where('slug', $slug)->first();
     $profile = template::where('slug', $slug)->first();
     if ($restaurant->user->role == 1) {
         return view('restaurant.profile', compact('restaurant'));
     }
     if ($profile->user->role == 3) {
         $tatoo = post::where('user_id', $profile->user->id)->OrderBy('id', 'ASC')->paginate(6);
         return view('tatoo.profile', compact('profile', 'tatoo'));
     }
 }
Exemplo n.º 4
0
 public function saveartikel(Request $request)
 {
     $post = new post();
     $post->author = Input::get('author');
     $post->judul = Input::get('judul');
     $post->isi = Input::get('message');
     $post->slug = str_slug(Input::get('judul'));
     if (Input::hasFile('gambar')) {
         $sampul = date("YmdHis");
         uniqid() . "." . Input::file('gambar')->getClientOriginalExtension();
         Input::file('gambar')->move(storage_path(), $sampul);
         $post->sampul = $sampul;
     }
     $post->save();
     return redirect(url('artikel/openssl_pkey_get_details(key)'));
 }
Exemplo n.º 5
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $data = array('data' => \App\post::paginate(5));
     return view('welcome')->with($data);
 }
Exemplo n.º 6
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $data = array('data' => post::all());
     return view('artikel.all')->with($data);
 }
Exemplo n.º 7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     post::find($id)->delete();
     return redirect(url('artikel'));
 }
Exemplo n.º 8
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($slug)
 {
     $user_id = Auth::id();
     $todo = post::findBySlugorfail($slug);
     $todo->delete();
     return $todo;
 }
Exemplo n.º 9
0
 public function updateComment($post_id)
 {
     $post_model = App\post::where('post_id', $post_id)->first();
     $page_id = $post_model->page_id;
     $post_model->comments()->delete();
     $comment_data = $this->getComment($post_id);
     $sentiment_data = $this->sentiment($comment_data);
     $count = 0;
     foreach ($comment_data as $comment) {
         $comment_model = new App\comment();
         $comment_model->comment = $comment['comment'];
         $comment_model->commenter = $comment['commenter'];
         $comment_model->commenter_id = $comment['commenter_id'];
         $comment_model->comment_datetime = $comment['comment_datetime'];
         $post_model->comments()->save($comment_model);
         $sentiment_model = new App\commentSentiment();
         $sentiment_model->joy = $sentiment_data[$count]['joy'];
         $sentiment_model->sadness = $sentiment_data[$count]['sadness'];
         $sentiment_model->trust = $sentiment_data[$count]['trust'];
         $sentiment_model->disgust = $sentiment_data[$count]['disgust'];
         $sentiment_model->fear = $sentiment_data[$count]['fear'];
         $sentiment_model->anger = $sentiment_data[$count]['anger'];
         $sentiment_model->surprise = $sentiment_data[$count]['surprise'];
         $sentiment_model->anticipation = $sentiment_data[$count]['anticipation'];
         $sentiment_model->result = $sentiment_data[$count]['result'];
         $comment_model->sentiment()->save($sentiment_model);
         $count++;
     }
     return redirect('post/' . $page_id . '/' . $post_id);
 }
Exemplo n.º 10
0
<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    $post = \App\post::OrderBy('id', 'ASC')->paginate(9);
    $event = \App\event::OrderBy('id', 'ASC')->paginate(9);
    $user = \App\template::OrderBy('id', 'ASC')->paginate(6);
    return view('welcome', compact('post', 'event', 'user'));
});
Route::get('/load', function () {
    return view('load');
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Exemplo n.º 11
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $post = post::find($id);
     return view('player.post.group_topic', ['post' => $post]);
 }
Exemplo n.º 12
0
        $arr[] = array('slug' => $key['slug'], 'isi' => $key['isi'], 'create_at' => $key['created_at'], 'author' => \App\User::find($key['idpengguna'])->first()['email'], 'tag' => $key['tag'], 'sampul' => url('images/', $key['sampul']), 'judul' => $key['judul']);
    }
    echo json_encode($arr);
});
Route::get("api/artikel/detail/{slug}", function ($slug) {
    $data = \App\post::where('slug', $slug)->first();
    $arr = array('slug' => $key['slug'], 'isi' => $key['isi'], 'create_at' => $key['created_at'], 'author' => \App\User::find($key['idpengguna'])->first()['email'], 'tag' => $key['tag'], 'sampul' => url('images/', $key['sampul']), 'judul' => $key['judul']);
    if (sizeof($key) == 0) {
        $data = array('status' => "Erorr", 'error_code' => 404, 'name' => 'artikel_notfound', 'msg' => 'Artikel Not Found');
        echo json_encode($data);
    } else {
        echo json_encode($arr);
    }
});
Route::get("api/artikel/{type}/{slug}", function ($type, $cari) {
    $data = \App\post::where($type, $cari)->get();
    $arr = array();
    foreach ($data as $key) {
        $arr[] = array('slug' => $key['slug'], 'isi' => $key['isi'], 'create_at' => $key['created_at'], 'author' => \App\User::find($key['idpengguna'])->first()['email'], 'tag' => $key['tag'], 'sampul' => url('images/', $key['sampul']), 'judul' => $key['judul']);
    }
    if (sizeof($data) == 0) {
        $data = array('status' => "Erorr", 'error_code' => 404, 'name' => 'artikel_notfound', 'msg' => 'Artikel Not Found');
        echo json_encode($data);
    } else {
        echo json_encode($arr);
    }
    if (sizeof($data) == 0) {
        $data = array('status' => "Erorr", 'error_code' => 304, 'name' => 'type_notfound', 'msg' => 'Type Not Found');
        echo json_encode($data);
    }
});
Exemplo n.º 13
0
 private function getStatistic($user_id)
 {
     $post_data = array();
     $posts = DB::table('post_user')->where('user_id', $user_id)->take(5)->orderBy('updated_at', 'decs')->get();
     $count = 0;
     foreach ($posts as $post) {
         $post_model = App\post::where('post_id', $post->post_id)->first();
         $post_data[$count]['page_id'] = $post_model->page_id;
         $post_data[$count]['id'] = $post->post_id;
         $num_joy = DB::table('commentSentiment')->join('comment', 'comment.comment_id', '=', 'commentSentiment.comment_id')->where('comment.post_id', $post->post_id)->where('result', 'joy')->count('commentSentiment.id');
         $num_sadness = DB::table('commentSentiment')->join('comment', 'comment.comment_id', '=', 'commentSentiment.comment_id')->where('comment.post_id', $post->post_id)->where('result', 'sadness')->count('commentSentiment.id');
         $num_trust = DB::table('commentSentiment')->join('comment', 'comment.comment_id', '=', 'commentSentiment.comment_id')->where('comment.post_id', $post->post_id)->where('result', 'trust')->count('commentSentiment.id');
         $num_disgust = DB::table('commentSentiment')->join('comment', 'comment.comment_id', '=', 'commentSentiment.comment_id')->where('comment.post_id', $post->post_id)->where('result', 'disgust')->count('commentSentiment.id');
         $num_fear = DB::table('commentSentiment')->join('comment', 'comment.comment_id', '=', 'commentSentiment.comment_id')->where('comment.post_id', $post->post_id)->where('result', 'fear')->count('commentSentiment.id');
         $num_anger = DB::table('commentSentiment')->join('comment', 'comment.comment_id', '=', 'commentSentiment.comment_id')->where('comment.post_id', $post->post_id)->where('result', 'anger')->count('commentSentiment.id');
         $num_surprise = DB::table('commentSentiment')->join('comment', 'comment.comment_id', '=', 'commentSentiment.comment_id')->where('comment.post_id', $post->post_id)->where('result', 'surprise')->count('commentSentiment.id');
         $num_anticipation = DB::table('commentSentiment')->join('comment', 'comment.comment_id', '=', 'commentSentiment.comment_id')->where('comment.post_id', $post->post_id)->where('result', 'anticipation')->count('commentSentiment.id');
         $post_data[$count]['sentiment'] = array('joy' => $num_joy, 'sadness' => $num_sadness, 'trust' => $num_trust, 'disgust' => $num_disgust, 'fear' => $num_fear, 'anger' => $num_anger, 'surprise' => $num_surprise, 'anticipation' => $num_anticipation);
         // DB::table('commentSentiment')
         // ->join('comment', 'comment.comment_id', '=', 'commentSentiment.comment_id')
         // ->where('comment.post_id', $post->post_id)
         // ->get(
         //   array(
         //     DB::raw('COUNT(id) AS joy'),
         //     DB::raw('COUNT(id) AS sadness'),
         //     DB::raw('COUNT(id) AS trust'),
         //     DB::raw('COUNT(id) AS disgust'),
         //     DB::raw('COUNT(id) AS fear'),
         //     DB::raw('COUNT(id) AS anger'),
         //     DB::raw('COUNT(id) AS surprise'),
         //     DB::raw('COUNT(id) AS anticipation'),
         //     )
         //   );
         $count++;
     }
     return $post_data;
 }