Ejemplo n.º 1
0
 public function store(Request $request)
 {
     $post = Post::create(['title' => $request->title, 'slug' => $request->slug, 'content' => $request->content, 'image' => $request->image, 'author' => $request->author]);
     foreach ($request->categories as $category) {
         $post_category = PostCategory::create(['post_id' => $post->id, 'cat_id' => $category]);
     }
 }
 public function run()
 {
     PostCategory::create(array('title' => 'District', 'description' => 'District updates'));
     PostCategory::create(array('title' => 'Service', 'description' => 'Service updates'));
     PostCategory::create(array('title' => 'Leadership', 'description' => 'Leadership updates'));
     PostCategory::create(array('title' => 'Fellowship', 'description' => 'Fellowship updates'));
     PostCategory::create(array('title' => 'Bulletin', 'description' => 'Service bulletin'));
 }
Ejemplo n.º 3
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $categories = PostCategory::lists('title', 'id');
     return view('pages.admin.posts.create', compact('categories'));
 }