public function store(Request $request)
 {
     $story = new Story();
     // $story->location_id=$request->input('location_id');
     $story->title = Input::get('title');
     $story->story = Input::get('story');
     $story->published = Input::get('published');
     $story->save();
 }
 public function store(Request $request)
 {
     $Story = new Story();
     $Story->title = $request->get('title');
     $Story->story = $request->get('story');
     $Story->published = $request->get('published');
     if (Input::get('published') === 'published') {
         $Story->published = 1;
     } else {
         $Story->published = 0;
     }
     $Story->location_id = $request->get('location_id');
     $Story->save();
     return redirect()->back();
 }
 public function index()
 {
     // create new sitemap object
     $sitemap = App::make("sitemap");
     // set cache key (string), duration in minutes (Carbon|Datetime|int), turn on/off (boolean)
     // by default cache is disabled
     $sitemap->setCache('laravel.sitemap', 60);
     // check if there is cached sitemap and build new only if is not
     if (!$sitemap->isCached()) {
         // add item to the sitemap (url, date, priority, freq)
         $sitemap->add(url('about'), Carbon::createFromDate(2016, 7, 15), '0.3', 'monthly');
         $sitemap->add(url('privacy'), Carbon::createFromDate(2016, 7, 15), '0.3', 'monthly');
         $sitemap->add(url('terms'), Carbon::createFromDate(2016, 7, 15), '0.3', 'monthly');
         $designers = Designer::orderBy('created_at', 'desc')->get();
         foreach ($designers as $designer) {
             $sitemap->add($designer->url, $designer->updated_at, 0.8, 'daily');
         }
         $places = Place::orderBy('created_at', 'desc')->get();
         foreach ($places as $place) {
             $sitemap->add($place->url, $place->updated_at, 0.8, 'daily');
         }
         $stories = Story::orderBy('created_at', 'desc')->get();
         foreach ($stories as $story) {
             $sitemap->add($story->url, $story->updated_at, 0.8, 'daily');
         }
         $tags = Tag::orderBy('created_at', 'desc')->get();
         foreach ($tags as $tag) {
             $sitemap->add($tag->url, $tag->updated_at, 0.8, 'weekly');
         }
     }
     // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
     return $sitemap->render('xml');
 }
Esempio n. 4
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $story = Story::find($id);
     $partial_display_link = 'story.partials._';
     $partial_display_link = $partial_display_link . $story->slug;
     return view('story/show', compact('story', 'partial_display_link'));
 }
 public function index()
 {
     // Get only the stories that have been published
     // $stories = Story::with('tags')->where('published', '=', '1')->get();
     // Get all the stories
     $stories = Story::with('tags')->get();
     return view('stories', ['stories' => $stories]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(StoryStoreRequest $request)
 {
     $project = $this->project->findByUid($request->input('project_uid'));
     $story = new Story();
     $story->project_id = $project->id;
     $story->uid = str_random(12);
     $story->title = $request->input('title');
     $story->who = $request->input('who');
     $story->what = $request->input('what');
     $story->why = $request->input('why');
     $story->status_id = $request->input('status_id');
     if ($story->save()) {
         Notification::success(trans('messages.story.created'));
         return redirect()->route('stories.show', ['uid' => $story->uid]);
     }
     Notification::error(trans('messages.story.createFailed'));
     return back()->withInput();
 }
Esempio n. 7
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     // Someone triggered the conversation without mentioning the target user
     if (is_null($this->tweet['in_reply_to_user_id'])) {
         return;
     }
     $conversation = Conversation::create(['trigger_tweet_id' => $this->tweet['id_str'], 'sniper_user_id' => $this->tweet['user']['id_str'], 'sniper_user_screen_name' => $this->tweet['user']['screen_name'], 'sniper_user_utc_offset' => $this->tweet['user']['utc_offset'], 'target_user_id' => $this->tweet['in_reply_to_user_id_str'], 'target_user_screen_name' => $this->tweet['in_reply_to_screen_name'], 'story_id' => Story::random()->id]);
     $this->dispatch(new AnnoyTheTarget($conversation));
 }
Esempio n. 8
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $story = Story::create(['name' => 'Default']);
     $chapters = [1 => ":target Hello. I am Xan - :sniper's annoying bot that will bug you until you respond to this tweet. :emoji_bell", 2 => ":target Yo! Haven't responded to :sniper's tweet yet? Consider this as a gentle reminder. :emoji_angel", 3 => ":target Come on, what could be taking you sooooo long? :sniper is waiting. Hit reply and let me take rest. :emoji_army", 4 => ":target Testing my patience? Or :sniper's? I'll give you a tip: DON'T :emoji_cross. Reply now. Now. NOW.", 5 => ":target I'll try to be polite. Ever considered how important your one tweet can be to :sniper? :emoji_heart_eye", 6 => ":target What if I keep tweeting to you until you beg for mercy? Want that? Then reply to :sniper. Come on!", 7 => ":target Fact #1: No one has made me request so much ever before. Fact #2: :sniper is NOT liking it. :emoji_angry", 8 => ":target You are a tough nut :emoji_dragon. I am tougher. Expect endless stream of tweets from :sniper in next few hours.", 9 => ":target OH GOD! Even my warnings are fruitless on you. Do you even have a heart? :emoji_heart :sniper's eyes are teary.", 10 => ":target I think I'll let :sniper know how stone-hearted you are. I am a robot :emoji_robot and still have more heart.", 11 => ":target Before I pass on bad news to :sniper, I'd like to give you one last chance. LAST. Mind replying? :emoji_angel", 12 => ":target The time has come, I guess. If you don't reply to this last reminder, I'll go and break :sniper's heart. :emoji_broken_heart"];
     $chaptersWithoutEmojis = [1 => ":target Hello. I am Xan - :sniper's annoying bot that will bug you until you respond to this tweet.", 2 => ":target Yo! Haven't responded to :sniper's tweet yet? Consider this as a gentle reminder.", 3 => ":target Come on, what could be taking you sooooo long? :sniper is waiting. Hit reply and let me take rest.", 4 => ":target Testing my patience? Or :sniper's? I'll give you a tip: DON'T. Reply now. Now. NOW.", 5 => ":target I'll try to be polite. Ever considered how important your one tweet can be to :sniper?", 6 => ":target What if I keep tweeting to you until you beg for mercy? Want that? Then reply to :sniper. Come on!", 7 => ":target Fact #1: No one has made me request so much ever before. Fact #2: :sniper is NOT liking it.", 8 => ":target You are a tough nut. I am tougher. Expect endless stream of tweets from :sniper in next few hours.", 9 => ":target OH GOD! Even my warnings are fruitless on you. Do you even have a heart? :sniper's eyes are teary.", 10 => ":target I think I'll let :sniper know how stone-hearted you are. I am a robot and still have more heart.", 11 => ":target Before I pass on bad news to :sniper, I'd like to give you one last chance. LAST. Mind replying?", 12 => ":target The time has come, I guess. If you don't reply to this last reminder, I'll go and break :sniper's heart."];
     foreach ($chaptersWithoutEmojis as $sequence => $body) {
         Chapter::create(['story_id' => $story->id, 'sequence' => $sequence, 'body' => $body]);
     }
 }
Esempio n. 9
0
 /**
  * Show the home page.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $designers = Designer::orderBy('id', 'desc')->take(9)->get();
     $places = Place::orderBy('id', 'desc')->take(9)->get();
     $stories = Story::whereHas('translations', function ($sub_query) {
         $sub_query->whereIn('locale', ['en', App::getLocale()])->whereNotNull('title')->whereNotNull('content');
     })->orderBy('id', 'desc')->take(9)->get();
     $tags = Tag::orderByRaw('RAND()')->take(9)->get();
     return view('pages.home', ['designers' => $designers, 'places' => $places, 'stories' => $stories, 'tags' => $tags]);
 }
Esempio n. 10
0
 /**
  * About us page
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function about(Request $request)
 {
     $data['designer_number'] = Designer::count();
     $data['design_number'] = Design::count();
     $data['place_number'] = Place::count();
     $data['story_number'] = Story::count();
     $data['tag_number'] = Tag::count();
     $data['user_number'] = User::count();
     $data['city_number'] = City::has('places')->orHas('designers')->count();
     return view('pages.about', $data);
 }
 /**
  * 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);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $limit = 20;
     for ($i = 0; $i < $limit; $i++) {
         DB::table('tags')->insert(['value' => $faker->word]);
     }
     $stories = Story::get();
     foreach ($stories as $story) {
         $numbers = range(1, 20);
         shuffle($numbers);
         $story->tags()->attach($numbers[0]);
         $story->tags()->attach($numbers[2]);
         $story->tags()->attach($numbers[4]);
     }
 }
 public function index()
 {
     /*$result = $this->pageContent();*/
     /*$stories=$this->storyContent();*/
     $result = DB::table('gallery_contents')->where('contentType', '=', 'image')->get();
     $result1 = DB::table('gallery_contents')->where('publishStatus', 1)->get();
     $result2 = DB::table('gallery_contents')->where('publishStatus', 2)->get();
     $result3 = DB::table('gallery_contents')->where('publishStatus', 3)->get();
     $result4 = DB::table('gallery_contents')->where('publishStatus', 4)->get();
     /*$result1 = $this->pageContent();
     		$result2 = $this->pageContent();
     		$result3 = $this->pageContent();
     		$result4 = $this->pageContent();*/
     $stories = Story::getStories();
     return view('client.index')->with('result1', $result1)->with('result2', $result2)->with('result3', $result3)->with('result4', $result4)->with('stories', $stories)->with('result', $result);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $limit = 20;
     for ($i = 0; $i < $limit; $i++) {
         DB::table('tags')->insert(['value' => $faker->word, 'created_at' => $faker->dateTime(), 'updated_at' => $faker->dateTime()]);
     }
     $stories = Story::get();
     foreach ($stories as $story) {
         $rand = rand(0, 20);
         DB::table('story_tag')->insert(['story_id' => $story->id, 'tag_id' => $rand, 'created_at' => $faker->dateTime(), 'updated_at' => $faker->dateTime()]);
         $rand = rand(0, 20);
         DB::table('story_tag')->insert(['story_id' => $story->id, 'tag_id' => $rand, 'created_at' => $faker->dateTime(), 'updated_at' => $faker->dateTime()]);
         $rand = rand(0, 20);
         DB::table('story_tag')->insert(['story_id' => $story->id, 'tag_id' => $rand, 'created_at' => $faker->dateTime(), 'updated_at' => $faker->dateTime()]);
     }
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     $limit = 20;
     for ($i = 0; $i < $limit; $i++) {
         DB::table('tags')->insert(['value' => $faker->word]);
     }
     $stories = App\Story::get();
     $array = array();
     for ($i = 0; $i < $limit; $i++) {
         $array[$i] = $i + 1;
     }
     foreach ($stories as $story) {
         # code...
         $story->tags()->attach($faker->randomElements($array, $count = 3));
     }
 }
 /**
  * save success story to database
  * @param StoryRequest $request
  * @return $this
  */
 public function storyFormSubmit(StoryRequest $request)
 {
     $success = 'false';
     $data = $request->all();
     try {
         Image::make($request->file('photo'))->resize(600, 400)->save(public_path('internal_css\\images\\photos') . '/' . $request->file('photo')->getClientOriginalName(), 60);
         $input = $request->except(['photo']);
         $input['image'] = pathinfo(public_path('internal_css\\images\\photos') . '/' . $request->file('photo')->getClientOriginalName(), PATHINFO_BASENAME);
         /*$request->file('photo')->move(public_path('images'), $request->file('photo')->getClientOriginalName());*/
         $input['firstname'] = Auth::user()->name;
         $input['lastname'] = Auth::user()->lastname;
         $input['email'] = Auth::user()->email;
         Story::create($input);
         $success = 'true';
     } catch (\Exception $e) {
     }
     return view('client.submit_story')->with('success', $success);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     DB::table('story_tag')->delete();
     DB::table('tags')->delete();
     $tagLove = Tag::create(array('id' => 1, 'value' => 'Love'));
     $tagComedy = Tag::create(array('id' => 2, 'value' => 'comedy'));
     $tagCrime = Tag::create(array('id' => 3, 'value' => 'crime'));
     $tagThriller = Tag::create(array('id' => 4, 'value' => 'thriller'));
     $this->command->info('seeding finished for tags and story_tag!');
     $stories = App\Story::get();
     foreach ($stories as $story) {
         $this->command->info($story->id);
         $tag_ids = array(1, 2, 3, 4);
         $story->tags()->attach($tag_ids);
     }
     $this->command->info('seeding finished for tags and story_tag!');
 }
Esempio n. 19
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     Story::destroy($id);
     return \Redirect::route('stories.index')->with('message', 'The story has been deleted!');
 }
 public function index()
 {
     $stories = Story::all();
     return view('stories', ['stories' => $stories]);
 }
Esempio n. 21
0
 /**
  * used to get story for stats section
  * @return [type] [description]
  */
 public function getStats()
 {
     $stories = Story::where('user_id', Auth::user()->id)->where('status', 'published')->get();
     return $stories;
 }
Esempio n. 22
0
 public function delete($id)
 {
     $item = Story::findOrFail($id);
     $item->delete();
     return redirect('/category/stories');
 }
 public function index()
 {
     $stories = Story::with('tags')->get();
     return view('stories', ['stories' => $stories]);
     //return "Hello from StoryController";
 }
Esempio n. 24
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request, $id)
 {
     $this->validate($request, ['action' => 'string|in:delete,restore,force_delete']);
     $story = Story::withTrashed()->find($id);
     if (empty($story)) {
         abort(404);
     }
     if ($request->user()->cannot('delete-story', $story)) {
         abort(403);
     }
     switch ($request->input('action')) {
         case 'restore':
             $story->restoreWithRelationships();
             break;
         case 'force_delete':
             $story->forceDeleteWithRelationships();
             break;
         default:
             $story->deleteWithRelationships();
     }
 }
 public function index()
 {
     $stories = Story::where('published', 1)->get();
     return view('stories', ['stories' => $stories]);
 }
 public function index()
 {
     $stories = Story::all();
     return view('stories', ['stories' => $stories]);
     //return "Hello from StoryController";
 }
Esempio n. 27
0
 public function destroy(Project $project, Story $story, Request $request)
 {
     $story->delete();
     return response()->json(['status' => 'success', 'message' => 'Story deleted.']);
 }
 public function api_stories()
 {
     $result = Story::all();
     return response()->json($result);
 }
 public function index()
 {
     $stories = Story::with('tags')->get();
     return view('stories', ['stories' => $stories]);
 }
Esempio n. 30
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $stories = Story::latest('updated_at')->get();
     return view('home', compact('stories'));
 }