public function index()
 {
     // Get only the stories that have been published
     // $stories = Story::where('published', '=', '1')->get();
     // Get all the stories
     $stories = Story::all();
     return view('stories', ['stories' => $stories]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $limit = 10;
     for ($i = 1; $i <= $limit; $i++) {
         DB::table('tags')->insert(['value' => $faker->city . ', ' . $faker->stateAbbr]);
         $stories = Story::all();
         foreach ($stories as $story) {
             DB::table('story_tag')->insert(['story_id' => $story->id, 'tag_id' => $i]);
         }
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $faker = Faker\Factory::create();
     $limit = 60;
     for ($i = 0; $i < $limit; $i++) {
         DB::table('tags')->insert(['value' => $faker->realText($faker->numberBetween(10, 20))]);
     }
     $stories = Story::all();
     foreach ($stories as $story) {
         $i = $story->id;
         $story->tags()->attach($i);
     }
 }
 public function index()
 {
     $stories = Story::all();
     return view('stories', ['stories' => $stories]);
 }
 public function api_stories()
 {
     $result = Story::all();
     return response()->json($result);
 }
 public function index()
 {
     $stories = Story::all();
     return view('stories', ['stories' => $stories]);
     //return "Hello from StoryController";
 }
Пример #7
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $stories = Story::all();
     return view('story.index', compact('stories'));
 }
 public function api_stories()
 {
     $stories = Story::all();
     return response()->json($stories);
 }