aboutsummaryrefslogtreecommitdiff
path: root/src/CamilStaps
diff options
context:
space:
mode:
Diffstat (limited to 'src/CamilStaps')
-rw-r--r--src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php83
-rw-r--r--src/CamilStaps/BotleaguesApi/Database/PasswordReminder.php2
-rw-r--r--src/CamilStaps/BotleaguesApi/Database/User.php14
3 files changed, 56 insertions, 43 deletions
diff --git a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php
index 76167e2..35826b9 100644
--- a/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php
+++ b/src/CamilStaps/BotleaguesApi/BotleaguesApiServiceProvider.php
@@ -5,7 +5,7 @@ use \Illuminate\Support\Facades\Request;
use \Illuminate\Support\ServiceProvider;
use \Illuminate\Support\Facades\App;
use \Illuminate\Support\Facades\Config;
-use \Dingo\Api\Facade\API;
+#use \Dingo\Api\Facade\API;
use Redirect;
use Response;
@@ -25,13 +25,21 @@ class BotleaguesApiServiceProvider extends ServiceProvider {
*/
public function boot()
{
- $this->package('camil-staps/botleagues-api', null, __DIR__.'/../..');
+ #$this->package('camil-staps/botleagues-api', null, __DIR__.'/../..');
+ #$this->loadAutoloader(base_path('vendor'));
+
+ $this->loadViewsFrom(__DIR__ . '/../../views', 'botleagues-api');
+ $this->publishes([ __DIR__ . '/../../views' => base_path('resources/view/vendor/botleagues-api')], 'views');
+
+ $this->publishes([ __DIR__ . '/../../config/botleaguesapi.php' => config_path('botleaguesapi.php')], 'config');
include __DIR__ . '/../../filters.php';
+
+ $api = app('api.router');
include __DIR__ . '/../../routes.php';
- // To allow loading API requests from the specified domain
- $allowed_origin = Config::get('config.allowed_origin');
+ // To allow loading API requests from the specified domain
+ $allowed_origin = config('botleaguesapi.allowed_origin');
if (is_array($allowed_origin)) {
$origin = Request::header('Origin');
if (in_array($origin, $allowed_origin)) {
@@ -44,9 +52,11 @@ class BotleaguesApiServiceProvider extends ServiceProvider {
}
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: Authorization');
+
+ var_dump(true);
$this->setupErrorHandlers();
- }
+ }
/**
* Register the service provider.
@@ -55,8 +65,7 @@ class BotleaguesApiServiceProvider extends ServiceProvider {
*/
public function register()
{
- $this->app->register('Dingo\Api\Provider\ApiServiceProvider');
- }
+ }
/**
* Get the services provided by the provider.
@@ -65,43 +74,43 @@ class BotleaguesApiServiceProvider extends ServiceProvider {
*/
public function provides()
{
- return array();
+ return array('CamilStaps\BotleaguesApi\BotleaguesApiServiceProvider');
}
/**
* Setup nice error handlers for exceptions and fatal errors
*/
private function setupErrorHandlers() {
- App::fatal(function($e) {
- return Response::make(
- ['error' => Config::get('app.debug') ? $e->getMessage() : "Internal error"],
- 500);
- });
+// App::fatal(function($e) {
+// return Response::make(
+// ['error' => config('app.debug') ? $e->getMessage() : "Internal error"],
+// 500);
+// });
- API::error(function(\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
- return Response::make(
- ['error' => 'Resource not found'],
- 404);
- });
- API::error(function(\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException $e) {
- return Response::make(
- ['error' => !Config::get('app.debug') || empty($e->getMessage()) ? 'Access denied' : $e->getMessage()],
- 404);
- });
- API::error(function(Exception\ValidationException $e) {
- return Response::make(
- [
- 'error' => $e->getMessage(),
- 'errors' => $e->errors
- ],
- 500);
- });
-
- API::error(function(\Exception $e) {
- return Response::make(
- ['error' => Config::get('app.debug') ? $e->getMessage() : "Internal error"],
- 500);
- });
+// API::error(function(\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
+// return Response::make(
+// ['error' => 'Resource not found'],
+// 404);
+// });
+// API::error(function(\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException $e) {
+// return Response::make(
+// ['error' => !config('app.debug') || empty($e->getMessage()) ? 'Access denied' : $e->getMessage()],
+// 404);
+// });
+// API::error(function(Exception\ValidationException $e) {
+// return Response::make(
+// [
+// 'error' => $e->getMessage(),
+// 'errors' => $e->errors
+// ],
+// 500);
+// });
+//
+// API::error(function(\Exception $e) {
+// return Response::make(
+// ['error' => Config::get('app.debug') ? $e->getMessage() : "Internal error"],
+// 500);
+// });
}
}
diff --git a/src/CamilStaps/BotleaguesApi/Database/PasswordReminder.php b/src/CamilStaps/BotleaguesApi/Database/PasswordReminder.php
index 40bc578..204df90 100644
--- a/src/CamilStaps/BotleaguesApi/Database/PasswordReminder.php
+++ b/src/CamilStaps/BotleaguesApi/Database/PasswordReminder.php
@@ -23,7 +23,7 @@ class PasswordReminder extends Model {
$this->valid_till = date("Y-m-d H:i:s", time() + 3600);
$user = User::find($this->userId);
- Mail::send('packages.camil-staps.botleagues-api.emails.auth.reminder', ['token' => $this->token], function($message) use ($user) {
+ Mail::send('botleagues-api::emails.auth.reminder', ['token' => $this->token], function($message) use ($user) {
$message->to($user->email, "User " . $user->id);
});
diff --git a/src/CamilStaps/BotleaguesApi/Database/User.php b/src/CamilStaps/BotleaguesApi/Database/User.php
index 383cc38..0af91c3 100644
--- a/src/CamilStaps/BotleaguesApi/Database/User.php
+++ b/src/CamilStaps/BotleaguesApi/Database/User.php
@@ -1,10 +1,14 @@
<?php
namespace CamilStaps\BotleaguesApi\Database;
-use Illuminate\Auth\Reminders\RemindableInterface;
-use Illuminate\Auth\UserInterface;
+use Illuminate\Auth\Authenticatable;
+use Illuminate\Auth\Passwords\CanResetPassword;
+use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
+use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
-class User extends Model implements UserInterface, RemindableInterface {
+class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
+
+ use Authenticatable, CanResetPassword;
protected $table = 'users';
protected $hidden = ['password', 'remember_token', 'api_key'];
@@ -65,11 +69,11 @@ class User extends Model implements UserInterface, RemindableInterface {
}
/**
- * Get the e-mail address where password reminders are sent.
+ * Get the e-mail address where password reset links are sent.
*
* @return string
*/
- public function getReminderEmail() {
+ public function getEmailForPasswordReset() {
return $this->email;
}
} \ No newline at end of file