Skip to content

Commit

Permalink
Added Wizard Token control
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Dec 11, 2018
1 parent f456dd3 commit 6ba3c1f
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions app/Http/Requests/Wizard/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@

namespace App\Http\Requests\Wizard;

use Illuminate\Foundation\Http\FormRequest;
use App\Http\Requests\Request;
use App\Traits\Modules as RemoteModules;
use Illuminate\Validation\Factory as ValidationFactory;

class Company extends FormRequest
class Company extends Request
{
use RemoteModules;

public function __construct(ValidationFactory $validation)
{
$validation->extend(
'check',
function ($attribute, $value, $parameters) {
return $this->checkToken($value);
},
trans('messages.error.invalid_token')
);
}

/**
* Determine if the user is authorized to make this request.
*
Expand All @@ -23,8 +38,14 @@ public function authorize()
*/
public function rules()
{
return [
$rules = [
'company_logo' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
];

if (!setting('general.api_token', false)) {
$rules['api_token'] = 'required|string|check';
}

return $rules;
}
}

0 comments on commit 6ba3c1f

Please sign in to comment.