Inheritance: extends Controller
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public static function login(Request $request)
 {
     $input = $request::all();
     $username = $request::get('username');
     $password = $request::get('password');
     if ($username == null || $password == null) {
         return ApiController::wrongDataFormat();
     }
     $user = User::where('username', '=', $username)->first();
     if ($user == null) {
         return UserApiController::usernameNotFound();
     }
     if (!Hash::check($password, $user['password'])) {
         return response()->json(['code' => 4]);
     }
     return response()->json(['code' => 0, 'user' => $user]);
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function apis(Request $request)
 {
     try {
         $input = $request::all();
         if ($input['api'] == null) {
             return $this->wrongDataFormat();
         }
         $api = $input['api'];
         switch ($api) {
             case 'login':
                 return UserApiController::login($request);
             default:
                 return 'default';
         }
     } catch (Exception $e) {
         return $this->wrongDataFormat();
     }
 }
Exemplo n.º 3
0
 /**
  * Initialize gallery controller.
  *
  * @param type GalleryRepositoryInterface $gallery
  *
  * @return type
  */
 public function __construct(GalleryRepositoryInterface $gallery)
 {
     $this->repository = $gallery;
     parent::__construct();
 }
Exemplo n.º 4
0
 /**
  * Initialize message controller.
  *
  * @param type MessageRepositoryInterface $message
  *
  * @return type
  */
 public function __construct(MessageRepositoryInterface $message)
 {
     $this->repository = $message;
     parent::__construct();
 }