-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor/store company data validation (#32)
* create a middleware for authenticated users to be redirected to the dashboard once they access the /not-an-admin route (#27) Co-authored-by: codejutsu1 <codejutsu@protonmail.com> * moved the store company data validation rules to a request file --------- Co-authored-by: Chidiebere Chukwudi <chidideveloper@gmail.com>
- Loading branch information
1 parent
1c9bbab
commit 779b8a5
Showing
3 changed files
with
41 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class StoreCompanyDataRequest extends FormRequest | ||
{ | ||
/** | ||
* Determine if the user is authorized to make this request. | ||
*/ | ||
public function authorize(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> | ||
*/ | ||
public function rules(): array | ||
{ | ||
return [ | ||
'name' => 'required', | ||
'about' => 'required', | ||
'url' => 'url|unique:companies,url', | ||
'ceo_name' => 'string|nullable', | ||
'cto_contact' => 'url|nullable', | ||
'cto_name' => 'string|nullable', | ||
'hr_name' => 'string|nullable', | ||
'hr_contact' => 'url |nullable', | ||
'logo' => 'required|mimes:png,jpeg,svg', | ||
'source_slug' => 'nullable|string|unique:companies,source_slug' | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters