/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\BlogPostRequest $request)
 {
     $post = new Blog_Post();
     $post->title = $request->input('title');
     $post->slug = $request->input('slug');
     $post->keywords = $request->input('keywords');
     $post->published = $request->input('published');
     $post->body = $request->input('body');
     $post->user_id = Auth::user()->id;
     $post->file_id = $request->input('file_id');
     $post->save();
     return redirect()->action('Blog\\BlogPostsController@index');
 }
Beispiel #2
0
 private function checkIfUnique($title)
 {
     $unique = Blog_Post::where('slug', $title)->count();
     if (!$unique) {
         $title = $title . '-2';
         $this->checkIfUnique($title);
     }
     return '';
 }
Beispiel #3
0
    Route::get('/', function () {
        return view('admin.index');
    });
    Route::get('/clients', function () {
        $clients = \App\Models\Client::all();
        $quotes = \App\Models\Quote::all();
        return view('admin.clients', ['clients' => $clients, 'quotes' => $quotes]);
    });
});
Route::get('/speech', function () {
    return view('speechdemo');
});
Route::get('/blog', function () {
    $posts = \App\Models\Blog_Post::with('Author')->with('picture')->get();
    return view('front.blog.index', ['posts' => $posts]);
});
Route::get('/blog/{slug}', function ($slug) {
    $post = \App\Models\Blog_Post::where('slug', $slug)->with('Author')->with('picture')->first();
    if ($post) {
        return view('front.blog.viewPost', ['post' => $post]);
    }
    return redirect('/blog');
})->name('viewBlogPost');
Route::get('/testr', function () {
    return public_path('uploads/files');
});
//    return dd($proj_types);
//    DB::enableQueryLog();
//    return dd($projects[0]->getAttributes());
//    return dd(DB::getQueryLog());
//    return dd($projects);