public static function fromRequest($request = null)
    {
        $request = $request ?: app('request');

        /** @var ParameterBag $data */
        $data = $request->json();

        $dataContainer = $data->get('data', []);
        if (array_has($dataContainer, '0')) {
            return RequestModelCollection::fromDataContainer($dataContainer, $request);
        }

        return (new static($request))->data($data->all());
    }
public static function fromRequest($request = null)
    {
        $request = $request ?: app('request');

        /** @var ParameterBag $data */
        $data = $request->json();

        $dataContainer = $data->get('data', []);
        if (array_has($dataContainer, '0')) {
            return RequestModelCollection::fromDataContainer($dataContainer, $request);
        }

        return (new static($request))->data($data->all());
    }
public static function fromRequest ( $ request = null ) { $ request = $ request ? : app ( 'request' ) ; /** @var ParameterBag $data */ $ data = $ request -> json ( ) ; $ dataContainer = $ data -> get ( 'data' , [ ] ) ; if ( array_has ( $ dataContainer , '0' ) ) { return RequestModelCollection :: fromDataContainer ( $ dataContainer , $ request ) ; } return ( new static ( $ request ) ) -> data ( $ data -> all ( ) ) ; }
creates instance from request

@param FormRequest $request
@return static|RequestModelCollection
creates instance from request