← prev | next →
praneet81 2019-04-27 11:33:33
senhorY 2019-04-27 11:32:59
What’s the problem?
It doesn’t allow it to save as an array
2019-04-27 11:33:42
senhorY 2019-04-27 11:32:48
I would recommend a basic php tutorial. You’ll be glad
any books you would recommend?
senhorY 2019-04-27 11:34:29
Didn’t know that
praneet81 2019-04-27 11:35:06
I know bro , we both are trying😊
senhorY 2019-04-27 11:35:11
2019-04-27 11:33:42
any books you would recommend?
I don’t really know. Google for a minute
praneet81 2019-04-27 11:35:13
I appreciate you helping me out
senhorY 2019-04-27 11:35:19
Or youtube
praneet81 2019-04-27 11:36:19
2019-04-27 11:33:42
any books you would recommend?
Go to YouTube and search for Php front to back by Traversy media channel
DeveloperProgrammer 2019-04-27 15:26:45
How to get data from fighter print in php or laravel?
2019-04-27 16:12:07
praneet81 2019-04-27 00:18:58
Try new FilebaseDatabase instead of simply new Database in above code…may work
praneet81 2019-04-27 16:20:54
2019-04-27 16:12:07
Try new FilebaseDatabase instead of simply new Database in above code…may work
Bro the code is working it creates the object, only problem is it can’t handle multiple requests
praneet81 2019-04-27 16:21:05
Replaces out with old request
praneet81 2019-04-27 16:21:27
Replaces it with new request*
2019-04-27 16:25:50
praneet81 2019-04-27 16:21:27
Replaces it with new request*
I think you are making new database object for every new request …. therefore overriding of record is done
2019-04-27 16:26:18
In store method
praneet81 2019-04-27 16:27:07
So i think i should put an if else statement🤔
2019-04-27 16:29:46
You should place object making code in constructor
2019-04-27 16:30:06
N use that object
2019-04-27 16:30:23
May this work
loveycom 2019-04-27 16:30:50
2019-04-27 16:25:50
I think you are making new database object for every new request …. therefore overriding of record is done
I doubt this will solve the problem.
loveycom 2019-04-27 16:33:13
The problem is the save() method. It writes to file name passed through get() method
loveycom 2019-04-27 16:33:39
I think I may write my own package later ó.
loveycom 2019-04-27 16:34:35
I currently have a solution writing to the file with index.
loveycom 2019-04-27 16:34:55
But the problem is that the index must be tracked
2019-04-27 16:41:47
loveycom 2019-04-27 16:30:50
I doubt this will solve the problem.
You are right… won’t work
senhorY 2019-04-27 17:45:54
Query on nested Arrays · Issue #33 · filebase/Filebase · GitHub
https://github.com/filebase/Filebase/issues/33
Query on nested Arrays · Issue #33 · filebase/Filebase –
GitHubHi, I have this saved database with me in this format. As you can see accounts have multiple array elements containing accID, server, expiry, editable, payment, etc.. Whenever I try to use query it…
senhorY 2019-04-27 17:46:16
praneet81 2019-04-27 16:27:07
So i think i should put an if else statement🤔
As you can see, the code in this issue makes use of arrays
senhorY 2019-04-27 17:46:24
So I think that’s the way to go
praneet81 2019-04-27 18:10:20
senhorY 2019-04-27 17:45:54
Query on nested Arrays · Issue #33 · filebase/Filebase · GitHub
https://github.com/filebase/Filebase/issues/33
It doesn’t cover inserting the data
senhorY 2019-04-27 18:11:06
No, but the keys under data are array
praneet81 2019-04-27 18:11:48
That’s the million dollar question bro
لشگر ورماخت 2019-04-27 18:12:10
Hi … How much is Laravel global income?
praneet81 2019-04-27 18:12:12
How do i insert that array programmatically
senhorY 2019-04-27 18:12:52
Try inserting a first item
senhorY 2019-04-27 18:13:37
$item->names = [];
$item->save();
senhorY 2019-04-27 18:14:04
It should work
loveycom 2019-04-27 18:31:51
senhorY 2019-04-27 18:12:52
Try inserting a first item
It can’t work. Filebase creates the file as soon as you call save(). It does not support append. So the next time you you call save(), your old file is overwritten. That’s the fact.
loveycom 2019-04-27 18:32:08
praneet81 2019-04-27 18:12:12
How do i insert that array programmatically
Here’s your solution
loveycom 2019-04-27 18:32:20
Isn’t this what you want?
loveycom 2019-04-27 18:33:17

See the indexes 1 to 4 inside data.
senhorY 2019-04-27 18:37:11
The documentation says the file won’t be overwritten if no arguments are passed through the save method
senhorY 2019-04-27 18:37:20
But I’ve never used it
loveycom 2019-04-27 18:39:01

The most important lines: 81, 89 and 93.
praneet81 2019-04-27 18:40:52
Wow
praneet81 2019-04-27 18:42:58
Where did you get line 81 from?
loveycom 2019-04-27 18:43:57
senhorY 2019-04-27 18:37:11
The documentation says the file won’t be overwritten if no arguments are passed through the save method
I have gone through the documentation, tested and used it.
The issue is you either get/create a document using get(name) method. If the file does not exist in your folder you specified, it creates the file and give you an instance of the file. In their documentation, they called the instance $item. If an item already exist, you can access the values in it using keys or even overwrite them. So if the item key exist, the old value will be replaced with the new value else, the new key value will be created.
loveycom 2019-04-27 18:47:42
praneet81 2019-04-27 18:42:58
Where did you get line 81 from?
This is not the right question. The right question is why put that line 81?
Like I said earlier, your entry needs to be indexed and index number tracked (i.e. know the last index number so that you can increment it). Hence, the need to save the index number. I tried to use .env to store the index number but I faced a lot of difficulty writing the latest index to .env file.
loveycom 2019-04-27 18:49:14
I later thought of config file and this worked though I have to create the file every time there is new entry. Hence, in config folder I created filebase.php file that looks like the image below
loveycom 2019-04-27 18:49:22
loveycom 2019-04-27 18:50:09
So reading the counter in filebase.php is what line 81 does.
← prev | next →