PHP code example of ozanmuyes / paraveley

1. Go to this page and download the library: Download ozanmuyes/paraveley library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ozanmuyes / paraveley example snippets


	
	
	namespace App\Http\Requests;
	
	use App\Http\Requests\Request;
	use Ozanmuyes\Paraveley\Traits\FormRequestExtractor;
	
	class CreateArticleFormRequest extends Request
	{
	    use FormRequestExtractor;
	
	    /**
	     * Determine if the user is authorized to make this request.
	     *
	     * @return bool
	     */
	    public function authorize()
	    {
	        return false;
	    }
	
	    /**
	     * Get the validation rules that apply to the request.
	     *
	     * @return array
	     */
	    public function rules()
	    {
	        return [
	            "title" => "

	
	
	namespace App\Http\Controllers;
	
	use Illuminate\Http\Request;
	
	use App\Http\Requests;
	use App\Http\Controllers\Controller;
	use App\Article;
	use App\Http\Requests\CreateArticleFormRequest;
	
	class ArticlesController extends Controller
	{		
	    /**
	     * Show the form for creating a new resource.
	     *
	     * @return Response
	     */
	    public function create()
	    {
	        $parsleyRules = (new CreateArticleFormRequest())->parsleyRules();
	
			/* 
			 * $parsleyRules is an array which carries these values depending our 
			 * CreateArticleFormRequest class' rules() function;
			 *
			 * array:3 [
			 *  "title" => array:3 [
			 *    "data-parsley-

		{!! Form::text("title", null, ["class" => "form-control"] + $parsleyRules["title"]) !!}
		

		<input name="title" class="form-control"  foreach ($parsleyRules["title"] as $key => $value) { echo $key . "='" . $value . "' "; }