コード例 #1
0
 public function updateBlog()
 {
     $blogData = Input::except('blogTags', '_token');
     if ($blogData['blogDate'] == '') {
         unset($blogData['blogDate']);
     }
     $validation = Validator::make($blogData, Blog::$updateBlog);
     if ($validation->passes()) {
         $blog = BlogTag::where('blog_id', Input::get('id'))->delete();
         $blog = Blog::where('id', Input::get('id'))->update($blogData);
         $blogTags = Input::get('blogTags');
         foreach ($blogTags as $blogTagsData) {
             BlogTag::create(['blog_id' => Input::get('id'), 'user_id' => '1', 'tag_id' => $blogTagsData]);
         }
         $Response = array('success' => '1', 'blogId' => Input::get('id'));
     } else {
         $Response = array('success' => '0', 'err' => $validation->messages());
     }
     return $Response;
 }
コード例 #2
0
                    Sysaxiom
                    <small>- Blog Posts</small>
                </h1>
                <div id="resultArea">
                <!-- First Blog Post -->
                @foreach ($posts as $post)
                <h2>
                    <a href="blog/{{ $post->blogUrl }}" style="text-decoration:none">{{ $post->blogTitle }}</a>
                </h2>
                <p class="lead">
                    by <a style="text-decoration:none">Sulthan Allaudeen</a>
                </p>
                <p align="left">
                Tagged : 
                <?php 
$tag = BlogTag::where('blog_id', $post->id)->get();
?>
                @foreach ($tag as $tagName)
                <?php 
$tagName = Tag::where('id', $tagName->tag_id)->pluck('tagTitle');
?>
                <a href="{{ URL::to('tag/'.$tagName) }}" title="{{ 'Tags related to : '.$tagName }}">{{ $tagName }}</a>
                @endforeach
                <?php 
$date = date('d M Y', strtotime($post->blogDate));
?>
</p>
                <p align="right"><span class="glyphicon glyphicon-time"></span> Posted on {{ $date }}</p>
                <hr>
                @endforeach
                <div style=" margin: auto;width: 65%;">
コード例 #3
0
                <!-- Blog Post -->

                <!-- Title -->
                <div id="resultArea">
                <h1>{{ $data->blogTitle}}</h1>

                <!-- Author -->
                <p class="lead">
                    by <a style="text-decoration:none">Sulthan Allaudeen</a>
                </p>
                <hr>
                <p align="left">
                Tagged : 
                <?php 
$tag = BlogTag::where('blog_id', $data->id)->get();
?>
                @foreach ($tag as $tagName)
                <?php 
$tagName = Tag::where('id', $tagName->tag_id)->pluck('tagTitle');
?>
                <a href="{{ URL::to('tag/'.$tagName) }}" title="{{ 'Tags related to : '.$tagName }}">{{ $tagName }}</a>
                @endforeach
                <?php 
$date = date('d M Y', strtotime($data->created_at));
?>
</p>
                <p align="right"><span class="glyphicon glyphicon-time"></span> Posted on {{ $date }}</p>
                <hr>
                <!-- Post Content -->
                <?php 
コード例 #4
0
 public function tagData($tag)
 {
     $tagId = Tag::where('tagTitle', $tag)->pluck('id');
     $tags = Tag::where('tagStatus', 1)->get();
     $blogTag = BlogTag::where('tag_id', $tagId)->pluck('id');
     #return $tagId;
     if ($blogTag == '') {
         return view('public.tag')->with('error', 'No Blog Post related to the Tag <b>' . $tag . '</b>')->with('tags', $tags)->with('tagName', $tag);
     } else {
         $tagData = Blog::find($tagId)->getBlogs;
         return view('public.tag')->with('tagData', $tagData)->with('tagList', $tagData)->with('tags', $tags)->with('tagName', $tag);
     }
 }
コード例 #5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $blog = Blog::findOrFail($id);
     BlogTag::where('blog_id', $blog->id)->delete();
     $blog->delete();
     return redirect()->route('blog_index');
 }