-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #300 from nurmuhammet-ali/master
add wizard form like functionality
- Loading branch information
Showing
9 changed files
with
241 additions
and
15 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,6 @@ | ||
<?php | ||
|
||
use Eminiarts\Tabs\Http\Controllers\ValidatorController; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::post('validate', [ValidatorController::class, 'index']); |
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,13 @@ | ||
<?php | ||
|
||
namespace Eminiarts\Tabs\Http\Controllers; | ||
|
||
use Illuminate\Foundation\Bus\DispatchesJobs; | ||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Foundation\Validation\ValidatesRequests; | ||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; | ||
|
||
class Controller extends BaseController | ||
{ | ||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; | ||
} |
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,46 @@ | ||
<?php | ||
|
||
namespace Eminiarts\Tabs\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Validator; | ||
|
||
class ValidatorController extends Controller | ||
{ | ||
/** | ||
* Work | ||
* @param Request $request | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
$request->validate([ | ||
'validations' => ['required'] | ||
]); | ||
|
||
$validations = $this->castArray(json_decode($request->input('validations'))); | ||
|
||
$request->validate($validations); | ||
|
||
return response()->json([ | ||
'message' => 'Yeah' | ||
]); | ||
} | ||
|
||
/** | ||
* Cast array | ||
*/ | ||
public function castArray(array $validations): array | ||
{ | ||
$castedArray = []; | ||
|
||
foreach ($validations as $validation) { | ||
$really = (array) $validation; | ||
|
||
foreach ($really as $key => $value) { | ||
$cs[$key] = $value; | ||
} | ||
} | ||
|
||
return $cs; | ||
} | ||
} |
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