Esempio n. 1
0
 public function store(Project $project, Request $request)
 {
     $user = JWTAuth::parseToken()->authenticate();
     $story = Story::create($request->only('name'));
     $project->stories()->save($story);
     $user->stories()->save($story);
     return response()->json(['status' => 'success', 'story' => $story, 'message' => 'Story created.']);
 }
Esempio n. 2
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. 3
0
 /**
  * used to create new story with draft status
  * @param  Request $request [description]
  * @return [json]           [description]
  */
 public function createStoryAsDraft(Request $request)
 {
     $input = $request->all();
     $input['user_id'] = Auth::user()->id;
     $input['status'] = 'draft';
     $image = $request->file('photo');
     $input['photo'] = str_random(10) . '-' . $image->getClientOriginalName();
     $destinationPath = 'story_photos';
     $request->file('photo')->move($destinationPath, $input['photo']);
     Story::create($input);
     $respons = ['success' => true];
     return $respons;
 }
Esempio n. 4
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|min:3', 'description' => 'required', 'photo' => 'image|image_size:<=300']);
     $input = $request->all();
     $fileName = '';
     if ($request->hasFile('photo')) {
         $file = $request->file('photo');
         $fileName = $file->getClientOriginalName();
         Image::make($file->getRealPath())->resize('64', '64')->save('images/' . $fileName);
         $input['photo'] = $fileName;
     }
     $input['user_id'] = Crypt::decrypt($input['user_id']);
     Story::create($input);
     flash()->success('Story has been created!');
     return redirect('/stories');
 }
 /**
  * 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);
 }
 public function store(Request $request)
 {
     Story::unguard();
     Story::create($request->only('title', 'story', 'published', 'location_id'));
     Story::reguard();
 }
 public function store(Request $request)
 {
     $story = Story::create(array('title' => $request->input('title'), 'story' => $request->input('story'), 'location_id' => $request->input('location_id'), 'published' => $request->input('publish')));
     $stories = array($story);
     return view('stories', ['stories' => $stories]);
 }