1. Go to this page and download the library: Download atayahmet/laravel-castable 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/ */
atayahmet / laravel-castable example snippets
Castable\CastableServiceProvider::class
namespace App\Http\Requests;
use Castable\Castable;
class ContactRequest extends Castable
{
protected $casts = [
'json' => [
//
],
'post' => [
'name' => 'string',
'age' => 'integer',
'student' => 'boolean',
'interests' => 'collection'
],
'query' => [
'save' => 'boolean'
]
];
/**
* 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 [
//
];
}
}