Esempio n. 1
0
 public function processImageUpload(Request $request)
 {
     $user = User::find($request['user']['sub']);
     $file = $request->file('file');
     $image = Media::create(['name' => $request->file('file')->getClientOriginalName(), 'ext' => $request->file('file')->guessExtension(), 'title' => $request->input('title'), 'description' => $request->input('description'), 'user_id' => $user->id, 'type' => 'IMAGE']);
     $filename = 'media_' . md5(strtolower(trim($image->name))) . '_' . $image->id . '.' . $image->ext;
     $image->name = $filename;
     $image->save();
     Storage::disk('local')->put($filename, File::get($file));
     Storage::disk('s3-aruma')->put('/uca/' . $filename, file_get_contents($file), 'public');
     return $image;
 }
Esempio n. 2
0
 public function run()
 {
     DB::table('users')->delete();
     $user = new User();
     $user->username = '******';
     $user->email = '*****@*****.**';
     $user->password = Hash::make('kierkegaard');
     $user->save();
     $user = new User();
     $user->username = '******';
     $user->email = '*****@*****.**';
     $user->password = Hash::make('usuario1');
     $user->save();
     $user = new User();
     $user->username = '******';
     $user->email = '*****@*****.**';
     $user->password = Hash::make('usuario2');
     $user->save();
     $user = new User();
     $user->username = '******';
     $user->email = '*****@*****.**';
     $user->password = Hash::make('usuario3');
     $user->save();
 }
Esempio n. 3
0
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['username' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'required']);
     if ($validator->fails()) {
         return response()->json(['message' => $validator->messages()], 400);
     }
     $user = new User();
     $user->username = $request->input('username');
     $user->email = $request->input('email');
     $user->password = Hash::make($request->input('password'));
     $user->name = $request->input('name');
     $user->lastname = $request->input('lastname');
     $user->save();
     $gravatar = md5(strtolower(trim($user->email)));
     $user->photo = $gravatar;
     $user->save();
     Storage::disk('s3-slam')->put('/slam/profiles/' . $gravatar, file_get_contents('http://www.gravatar.com/avatar/' . $gravatar . '?d=identicon&s=150'), 'public');
     return response()->json($user);
 }
 public function unremark(Request $request, $id)
 {
     $user = User::find($request['user']['sub']);
     $organization = Organization::find($id);
     DB::transaction(function () use($request, $organization) {
         $organization->remark = 0;
         $organization->save();
     });
     return $organization;
 }
Esempio n. 5
0
 public function signup(Request $request)
 {
     $validator = Validator::make($request->all(), ['username' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'required']);
     if ($validator->fails()) {
         return response()->json(['message' => $validator->messages()], 400);
     }
     $user = new User();
     $user->username = $request->input('username');
     $user->email = $request->input('email');
     $user->password = Hash::make($request->input('password'));
     $user->save();
     //$this->dispatch(new UpdateProfilePicture($user));
     $gravatar = md5(strtolower(trim($user->email)));
     $user->photo = $gravatar;
     $user->save();
     Storage::disk('s3-aruma')->put('/aruma/profiles/' . $gravatar, file_get_contents('http://www.gravatar.com/avatar/' . $gravatar . '?d=identicon&s=150'), 'public');
     return response()->json(['token' => $this->createToken($user)]);
 }