Category : arrays

I receive the information of all Banance exchange currencies as follows. $api = new BinanceAPI(decrypt(setting()->get(‘binanceApiKey’)) , decrypt(setting()->get(‘binanceSecretKey’))); $encodedSku = json_encode($api->coins() , true); print(‘<pre>’); print_r($encodedSku); print(‘</pre>’); And the output is like this { "coin": "STPT", "depositAllEnable": true, "withdrawAllEnable": true, "name": "Standard Tokenization Protocol", "networkList": [ { "network": "ETH", "coin": "STPT", "withdrawIntegerMultiple": "0.00000001", } ] }, { ..

Read more

I found a code snippet that solved the problem I had with uniqueness validation, when dealing with arrays: $rules = [ // this ones are ok for all ‘staff.*.name’ => ‘required|max:128’, ‘staff.*.description’ => ‘max:512’, ‘staff.*.anothervalue’ => ‘string’, ]; // here loop through the staff array to add the ignore foreach($request->staff as $key => $staff) { ..

Read more

I need to apply a required rule to a array field in my form request when the another array field, in the same index, has a certain value. Example: public function rules(): array { return [ ‘data’ => ‘array’, ‘data.*.is_admin’ => ‘required|boolean’, ‘data.*.area’ => [ ‘nullable’, Rule::requiredIf($condition), // other rules… ] ] } When evaluating ..

Read more

in my laravel application, I have the following form to submit datas {!! Form::open(array(‘route’ => ‘testresults.store’,’method’=>’POST’)) !!} <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12"> <div class="form-group"> <strong>Test ID:</strong> @foreach ($getTests as $object) {!! Form::text(‘test_id’, ”.$object->id .”, array(‘placeholder’ => ‘Test Name’,’class’ => ‘form-control’,’readonly’)) !!} @endforeach </div> </div> <div class="col-xs-12 col-sm-12 col-md-12"> <table class="table table-bordered"> <tr> <th>Test</th> <th ..

Read more

in my laravel application, I have the following form to submit datas {!! Form::open(array(‘route’ => ‘testresults.store’,’method’=>’POST’)) !!} <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12"> <div class="form-group"> <strong>Test ID:</strong> @foreach ($getTests as $object) {!! Form::text(‘test_id’, ”.$object->id .”, array(‘placeholder’ => ‘Test Name’,’class’ => ‘form-control’,’readonly’)) !!} @endforeach </div> </div> <div class="col-xs-12 col-sm-12 col-md-12"> <table class="table table-bordered"> <tr> <th>Test</th> <th ..

Read more

Context: To give context, I am trying to create a graph with the months as the labels and the number of applications as the dataset. My code: $apps = Application::whereBetween(‘created_at’, [ Carbon::now()->startOfYear(), Carbon::now()->endOfYear(), ]) ->get() ->groupBy(function ($val) { return Carbon::parse($val->created_at)->format(‘M’); }) ->toArray(); returns array:3 [▼ "Jan" => array:2 [▶] "Feb" => array:1 [▶] "May" => ..

Read more

I want to return the data in $users as an array as well as the data in $this->guard()->user() as not inside an array. I’ve tried as giveb below. But it generates the error – Argument 2 passed to SymfonyComponentHttpFoundationJsonResponse::__construct() must be of the type int, object given, called in C:wamp64wwwLaravelprojectsContent-Que-Laravel-APIvendorlaravelframeworksrcIlluminateHttpJsonResponse.php on line 32. Am using ..

Read more

I have an input which is array <input type="text" name="review_rate[]" value="{{$rinfo->review_rate}}" class="form-control text-center pay_review_scale_{{$cnts}}"> Now this input is not mandatory so when user doesnt add any value in first row and adds value in second row then it shows only 1 value in controller array $review_rate= $request->review_rate; echo "<pre>"; print_r($review_rate);exit; // this shows only second ..

Read more

$requestData=$request->all(); $validator = Validator::make($requestData, [ ‘fileId’ => ‘required|integer’ ] $response = Orders::Create($requestData); In controller, i’m taking fileIDs as input. I want that to be an array. So, I have given like below in model. protected $casts = [ ‘fileID’ => ‘array’, ]; Assuming am getting all data in $requestData in $orders of my modelobserver, for ..

Read more

I have an associative multidimensional array with multiple state ids: array:2 [ 0 => array:2 [ "url" => "http://www.kerluke.net/qui-sint-debitis-quo-et-suscipit-dolores-dolor-quae" "us_states_ids" => array:2 [ 0 => "15" 1 => "16" ] ] 1 => array:2 [ "url" => "http://www.migato.net/qui-sint-debitis-quo-et-suscipit-dolores-dolor-quae" "us_states_ids" => array:3 [ 0 => "15" 1 => "24" 2 => "28" ] ] ] Now ..

Read more

essa função não consegue armazena mais de uma informação, alguem poderia me da uma força ? public function adicionacarrinho(Request $request){ $produto = produto::where("urlamigavel",$request->url)->first(); if(empty($request->session()->dados)) { $request->session()->put(‘dados’,$produto); }else{ $dados[0]=$request->session()->dados; $dados[1]=$produto; dd($dados); $request->session()->put(‘dados’,$dados); } dd($request->session()->all()); } Sourc..

Read more

this function can’t store more than one information, could someone give me strength? public function adicionacarrinho(Request $request){ $produto = produto::where("urlamigavel",$request->url)->first(); if(empty($request->session()->dados)) { $request->session()->put(‘dados’,$produto); }else{ $dados[0]=$request->session()->dados; $dados[1]=$produto; dd($dados); $request->session()->put(‘dados’,$dados); } dd($request->session()->all()); } Sourc..

Read more

I have been fighting with this all day and would like another set of eyes to maybe give me some insight. I’m not sure I am even approaching this the correct way. I have two arrays but these arrays have different number lists. I’am bulding an app with laravel. $naflr = array( 0 => "NA" ..

Read more