コード例 #1
0
 public function user_posts_all(Request $request)
 {
     $user = $request->user();
     $posts = Posts::where('author_id', $user->id)->orderBy('created_at', 'desc')->paginate(5);
     $title = $user->name;
     return view('home')->withPosts($posts)->withTitle($title);
 }
コード例 #2
0
ファイル: page.blade.php プロジェクト: koyeo/bichon
@extends('qz.layout')

@section('title')
<?php 
$page = Pages::getPageByAlias($alias);
if (!$child) {
    $child = Pages::getFirstSubPage($page->id);
} else {
    $child = Pages::getPageByAlias($child);
}
$hasChild = $child ? true : false;
if ($post) {
    $postRow = Posts::where('alias', $post)->first();
}
?>
{{ $post&&isset($postRow) ? $postRow->title : ''}}
{{$page->title}}
{{$hasChild ? $child->title : ''}}
@endsection

@section('links')

@endsection

@section('content')

  <div class="lunbo-box cleard">
        <img src="/vendor/qz/images/top-3.jpg" height="400" width="100%" alt="" />
        
  </div><!-- top 轮播 -->
<!-- start content -->
コード例 #3
0
ファイル: posts.php プロジェクト: jsdecena/synthesis
        $data['id'] = $posts[$i]['id'];
        $data['title'] = $posts[$i]['title'];
        $data['slug'] = $posts[$i]['slug'];
        $data['content'] = $posts[$i]['content'];
        $data['created_at'] = $posts[$i]['created_at'];
        $author = Users::find($posts[$i]['author_id']);
        $data['author'] = $author->firstname;
        $results[] = $data;
    }
    die(json_encode($results));
});
//GET THE PARTICULAR POST
$app->get('/api/v1/posts/:slug', function ($slug) use($app) {
    $response = $app->response();
    $response->header('Access-Control-Allow-Origin', '*');
    $posts = Posts::where('slug', $slug)->get();
    $results = array();
    for ($i = 0; $i < sizeof($posts); $i++) {
        $data['id'] = $posts[$i]['id'];
        $data['title'] = $posts[$i]['title'];
        $data['slug'] = $posts[$i]['slug'];
        $data['content'] = $posts[$i]['content'];
        $data['created_at'] = $posts[$i]['created_at'];
        $author = Users::find($posts[$i]['author_id']);
        $data['author'] = $author->firstname;
    }
    $results[] = $data;
    die(json_encode($results));
});
$app->post('/api/v1/posts', function () use($app) {
    $posts = new Posts();
コード例 #4
0
ファイル: pages.php プロジェクト: jsdecena/slimapp
{
    protected $table = 'posts';
    protected $fillable = [];
}
//GET ALL THE USERS
$app->get('/api/v1/pages', function () use($app) {
    $response = $app->response();
    $response->header('Access-Control-Allow-Origin', '*');
    $pages = Posts::where('post_type', 2)->get();
    $response->write(json_encode($pages));
});
//GET THE PARTICULAR USER
$app->get('/api/v1/pages/:slug', function ($slug) use($app) {
    $response = $app->response();
    $response->header('Access-Control-Allow-Origin', '*');
    $pages = Posts::where('slug', $slug)->first();
    $response->write(json_encode($pages));
});
$app->post('/api/v1/pages', function () use($app) {
    $pages = new Posts();
    $pages->title = $app->request()->post('title');
    $pages->slug = str_replace(' ', '-', $app->request()->post('slug'));
    $pages->content = $app->request()->post('content');
    $pages->author_id = $app->request()->post('author_id');
    $pages->save();
    die(json_encode($pages));
});
$app->put('/api/v1/pages/:id', function ($id) use($app) {
    $pages = Posts::find($id);
    $pages->title = $app->request()->post('title');
    $pages->slug = str_replace(' ', '-', $app->request()->post('slug'));
コード例 #5
0
 public function managePosts()
 {
     $posts = Posts::where('user_id', '=', Auth::id())->get();
     return View::make('manage_posts', array('posts' => $posts));
 }
コード例 #6
0
 /**
  * Display the specified topic.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $posts = Posts::where('topic_id', '=', $id)->get();
     return View::make('topics.show', compact('posts'));
 }
コード例 #7
0
ファイル: UserController.php プロジェクト: Vishalhari/myblog
 public function index()
 {
     $posts = Posts::where('active', 1)->orderby('created_at', 'desc')->paginate(5);
     $title = 'Latest Posts';
     return view('home')->withPosts($posts)->withTitle($title);
 }
コード例 #8
0
ファイル: admin.route.php プロジェクト: kuslahne/SlimBlog
            $app->redirect($settings->base_url . '/admin/users/new');
        }
        if ($email == "" or !filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $app->flash('error', 3);
            $app->redirect($settings->base_url . '/admin/users/new');
        }
        $redirect = $settings->base_url . '/admin/users';
        Users::insert(array('username' => $username, 'password' => $password, 'email' => $email, 'created_at' => $created_at));
        $app->render('success.html', array('redirect' => $redirect));
    });
    $app->get('/posts/activate/:id', $authenticate($app, $settings), function ($id) use($app, $settings) {
        $post = Posts::where('id', '=', $id)->first();
        if ($post) {
            $redirect = $settings->base_url . '/admin';
            $post->update(array('active' => 'true'));
            $app->render('success.html', array('redirect' => $redirect));
        } else {
            $app->render('404_post.html');
        }
    })->conditions(array('id' => '\\d+'));
    $app->get('/posts/deactivate/:id', $authenticate($app, $settings), function ($id) use($app, $settings) {
        $post = Posts::where('id', '=', $id)->first();
        if ($post) {
            $redirect = $settings->base_url . '/admin';
            $post->update(array('active' => 'false'));
            $app->render('success.html', array('redirect' => $redirect));
        } else {
            $app->render('404_post.html');
        }
    })->conditions(array('id' => '\\d+'));
});
コード例 #9
0
 public function template_form()
 {
     $objPost = new Posts();
     $objTaxonomyitem = new Taxonomyitem();
     $objTaxonomyitem = $objTaxonomyitem->where('vid', '=', '5')->get();
     $i = 0;
     $mang = array();
     foreach ($objTaxonomyitem as $row) {
         $mang[$i] = $row;
         $mang[$i++]['sub'] = $objPost->where('cat_id', '=', $row['id'])->where('status', '=', 1)->get();
     }
     return view('frontend::template_forms', array('mang' => $mang));
 }