public function watch($id)
 {
     $video = DB::table('katalog')->leftjoin('publisher', 'katalog.publisher', '=', 'publisher.id')->where('katalog.id', '=', $id)->get(array('katalog.id', 'katalog.title', 'katalog.release', 'katalog.numpage', 'publisher.publishername', 'katalog.file', 'katalog.ISBN'));
     $authors = AuthorKatalog::get_author_katalog($id);
     $katalog = Katalog::find($id);
     $katalog->view++;
     $katalog->save();
     return View::make('front.watch', compact('video', 'authors'));
 }
 public function addArtikel()
 {
     $act = 'add';
     $author = Author::all();
     $tags = Tag::all();
     if (Input::has('submit')) {
         $rules = array('title' => 'required', 'tag' => 'required', 'content' => 'required');
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->passes()) {
             $katalog = new Katalog();
             $katalog->title = Input::get('title');
             $katalog->category = 3;
             $katalog->summary = Input::get('content');
             $katalog->release = date('Y');
             $katalog->save();
             foreach (Input::get('author') as $value) {
                 $author = new AuthorKatalog();
                 $author->idkatalog = $katalog->id;
                 $author->author = $value;
                 $author->save();
             }
             $tag = str_replace(' ', '', Input::get('tag'));
             $tags = explode(',', $tag);
             foreach ($tags as $tag) {
                 $katalogtag = new KatalogTag();
                 $katalogtag->idkatalog = $katalog->id;
                 $idtag = Tag::where('tag', '=', $tag)->get();
                 if (count($idtag) > 0) {
                     $katalogtag->idtag = $idtag[0]->id;
                     $katalogtag->save();
                 } else {
                     $tagclass = new Tag();
                     $tagclass->tag = $tag;
                     $tagclass->save();
                     $katalogtag->idtag = $tagclass->id;
                     $katalogtag->save();
                 }
             }
             return Redirect::to('admin/rkmartikel')->with('sukses', 'Berhasil rekam Artikel!');
         } else {
             return Redirect::to('admin/rkmartikel')->withInput()->withErrors($validator);
         }
     } else {
         return View::make('admin.artikel', compact('act', 'author', 'tags'));
     }
 }
Exemplo n.º 3
0
							...
						@endif
						</h5></a>
						@if($value->category!=3)
						<div class="result-img">
						
							@if($value->img!=null || $value->img!='')
							<img src="{{ 'http://localhost/repository-djpbn-master/public/image/cover/'.$value->img }}">
							@else
							<img src="http://localhost/repository-djpbn-master/public/image/nopict.jpg">
							@endif
						</div>
						@endif
						<div class="result-content" >
							<?php 
$author = AuthorKatalog::get_author_katalog($value->id);
?>
							<span>
							@foreach($author as $k=>$v)
								<a href="{{ URL::to('author/'.$v->id)}}">{{ $v->authorname }}</a>,  
							@endforeach
							</span>
							<p>{{ substr($value->summary,0,200).' ...' }}</p>
						</div>
					</li>
					@endforeach
				</ul>
			@else
				<div style="text-align:right">
					<img src="http://localhost/repository-djpbn-master/public/image/empty-box.jpg">
					<h3>ZOONKK...</h3>