-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexptra_details.php
More file actions
59 lines (49 loc) · 2.53 KB
/
exptra_details.php
File metadata and controls
59 lines (49 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
public function blog_single_id(Request $req,$id)
{
if($req->search_text)
{
$search = $req->search_text;
$id = '';
$arr = blog::where('title','like','%'.$search.'%')->paginate(1);
$arr2 = blog_comment::where('user_id',$id)->get();
$prev = '';
$next = '';
return view('blog-single',['arr'=>$arr,'arr2'=>$arr2,'prev'=>$prev,'next'=>$next]);
}
else
{
if($req->submit_comment)
{
$name = $req->name;
$email = $req->email;
$subject = $req->subject;
$message = $req->message;
$user_id = $id;
$sql_insert = array('user_id'=>$user_id,'name'=>$name,'email'=>$email,'subject'=>$subject,'message'=>$message);
blog_comment::create($sql_insert);
}
$arr = blog::where('id',$id)->get();
$arr2 = blog_comment::where('user_id',$id)->get();
$prev = blog::where('id','<',$id)->orderBy('id','desc')->first();
$next = blog::where('id','>',$id)->orderBy('id','asc')->first();
return view('blog-single',['arr'=>$arr,'arr2'=>$arr2,'prev'=>$prev,'next'=>$next]);
}
}
<div>
@if($prev != null)
<div class="prev-btn col-md-6 col-sm-6 col-xs-6">
<a href="/blog-single/{{$prev->id}}"><i class="fa fa-angle-left"></i>Previous</a>
</div>
@else
<div class="prev-btn col-md-6 col-sm-6 col-xs-6" style="margin-bottom:100px;"></div>
@endif
</div>
<div>
@if($next != null)
<div class="next-btn col-md-6 col-sm-6 col-xs-6">
<a href="/blog-single/{{$next->id}}">Next<i class="fa fa-angle-right"></i></a>
</div>
@else
<div class="next-btn col-md-6 col-sm-6 col-xs-6" style="margin-right: 100px;"></div>
@endif
</div>