I’m working on an application that registers users in a database of a domain I have. I developed it using Android Studio, and I’m having some problems handling the users info to the php file using the …
Tag: php
PHP array slice from position + attempt to return fixed number of items
I’m looking for an efficient function to achieve the following. Let’s say we have an array: Slicing from a position should always return 5 values. 2 before the position index and 2 values after the position index – and of course, the position index itself. If a position index is at the begin…
Laravel Nova Self-referential Relationship
In Laravel, if I want to create a self-referential relationship I can do the following: How can I make a Laravel Nova resource display this connection? Answer You can achieve what you want like this: This will allow to choose a parent post when you create or update a post. When you are in the detail page of a…
how to filter data based on fromdate and todate?
This is my construct query, i need to filter data based on fromdate and todate,and also based on adminid, whats wrong am i doing here,is there any other way? Answer You’re not concatenating. You forgot the ‘.’. There is also no need to append the ‘NULL’. If you don’t want t…
Laravel Backpack, Show Address (Json) in Column
I want to show the name field from address json (using algolia), how do i do that? I tried this: But can’t manage to work. Also, it always return error. In preview, i want to show full address too, but only got json return. Thanks in advance Answer Managed to work with Custom Fields. Controller: Create …
Using HTML.PHP instead of html.twig – not working
class DefaultController extends Controller { public function indexAction($page, $name) { return $this->render(‘default/new.html.php’ // , array( // $name =&…
MS SQL Native Client Login failed for user when connecting via PHP
I have a Windows 2008 R2 Datacenter server with IIS 7.5, MS SQL 2012 Express, using PHP 5.6 trying to connect to a database I created, testDB, via Windows Authentication, but am failing to do so. Here is my PHP I am using to connect to my SQL ServerInstance: When I run this I receive: Connection failed. Array…
Laravel 5.7 + Spatie Permissions + JWT auth
I’m setting up a REST API using Laravel 5.7. To validate authentication I JWT-auth and for permissions and roles I use Spatie. My problem: when trying to link a role to a user I get the following error The role do exist in the database: This is how I’m trying to assign a role to the user: As IR…
How to add space with specified string length in php
I want to like add space in sting with specified string length. For example : Hello is my string & i set string length 30 so next string should be start after length 30 so it should be like Hello …
Laravel – Collections. How to separate array into 2 groups
I have created 2 collections(arrays) which each contain an array of 5 items/events. Output of the above: In my next loop, it simply goes through every item of the array 1 by 1. I need to split the 5 items into a further 2 groups: group of 2 group of 3 so I can wrap a div around each group.