How to call function in PaymentDetail on Payment?

|
2019-09-24 19:49:03
Hi I’m a newbie, should I learn vue js 2 or 3?
Marvixino 2019-09-24 20:22:54
do you know a new good tutorial about queue upload?
MatPk 2019-09-24 20:56:55
i disabled csrf token for one url
and now when i send a post request to this url it shows me nothing
what is problem
here is my code
MatPk 2019-09-24 20:57:10
Route::post(‘/articles’,[‘uses’=>’ArticleController@store’,’as’=>’article.create1′]);
MatPk 2019-09-24 20:57:23
protected $except = [
‘localhost:8000/api/articles/*’
];
MatPk 2019-09-24 20:57:52
public function store(Request $request)
{

dd(‘awdawd’);
dd($request->all());
}

MatPk 2019-09-24 20:58:03
MatPk 2019-09-24 20:57:10
Route::post(‘/articles’,[‘uses’=>’ArticleController@store’,’as’=>’article.create1′]);

api.php

MatPk 2019-09-24 20:58:16
MatPk 2019-09-24 20:57:23
protected $except = [
‘localhost:8000/api/articles/*’
];

verifyCsrfToken.php

MatPk 2019-09-24 21:02:09
protected $except = [
‘http://localhost:8000/api/articles/*’
];
still not working
MatPk 2019-09-24 21:03:12
i am using restful api
MatPk 2019-09-24 21:04:01
with postman
rafaellaurindo 2019-09-24 21:06:26
Try using just you route, without the domain.
rafaellaurindo 2019-09-24 21:06:59
Like:

protected $except = [
‘/api/articles/*’
];

MatPk 2019-09-24 21:08:22
rafaellaurindo 2019-09-24 21:06:59
Like:

protected $except = [
‘/api/articles/*’
];

still not working

MatPk 2019-09-24 21:08:31
i am using api.php bro
MatPk 2019-09-24 21:10:45
ok
i deleted this csrf unprotected from csrfTokenVerify
but still not working
MatPk 2019-09-24 21:17:06
well its works in browser and does not work in postman ๐Ÿ˜
MatPk 2019-09-24 21:18:24
thank u very much
it works now
MatPk 2019-09-24 22:10:30
api php does not need csrf token
but i have a question :
is this way cant attacked with csrf??
gui_leiva 2019-09-25 00:12:40
MatPk 2019-09-24 22:10:30
api php does not need csrf token
but i have a question :
is this way cant attacked with csrf??

Use jwt

Behibehinew 2019-09-25 04:40:40
MatPk 2019-09-24 22:10:30
api php does not need csrf token
but i have a question :
is this way cant attacked with csrf??

use jwt

ikudratov 2019-09-25 07:10:03
MatPk 2019-09-24 22:10:30
api php does not need csrf token
but i have a question :
is this way cant attacked with csrf??

Try this:

ikudratov 2019-09-25 07:10:33
or this:
https://laravel.com/docs/5.8/passport
baguss42 2019-09-25 11:18:30
laravel_discuss-14117.jpg
hello guys, i wanna ask, i have 2 models, Payment and PaymentDetail. how to call function in PaymentDetail on Payment ? i got error : Call to undefined method Illuminate\Database\Query\Builder::createNew()
goodluckalltheway 2019-09-25 11:36:51
You may want to organize your code a little bit
Paymenr and PaymentDetails are two separete models in your case i presume
And basic OOP states if you want to use a function in class A when your in class B, you have to inherit it. For your case i do not think that will be good idea
goodluckalltheway 2019-09-25 11:40:18
laravel_discuss-14119.jpg
I’ve drafted something for you
goodluckalltheway 2019-09-25 11:42:30
laravel_discuss-14120.jpg

YashGhantala 2019-09-25 11:43:43
baguss42 2019-09-25 11:18:30
hello guys, i wanna ask, i have 2 models, Payment and PaymentDetail. how to call function in PaymentDetail on Payment ? i got error : Call to undefined method Illuminate\Database\Query\Builder::createNew()

because Model.php does not have any createNew() you need to make createNew() in relative Controller.

baguss42 2019-09-25 11:52:32
@geffmuthami thank you very much, the answer you gave me was very clear and very detailed
baguss42 2019-09-25 11:53:36
YashGhantala 2019-09-25 11:43:43
because Model.php does not have any createNew() you need to make createNew() in relative Controller.

right i think so, thank you

goodluckalltheway 2019-09-25 11:59:41
baguss42 2019-09-25 11:52:32
@geffmuthami thank you very much, the answer you gave me was very clear and very detailed

Nice. But there is a typo on the foreach loop
There is a new keyword missing on the loop

$payment->paymentDetails()->save(new PaymentDetail($values));

baguss42 2019-09-25 12:04:38
ah, my createNew function on PaymentDetail are private ๐Ÿ˜‚
SM_NHosseini 2019-09-25 12:34:56
guys i have a tricky question
SM_NHosseini 2019-09-25 12:35:16
does anyone know how to disable appends on relation ?
SM_NHosseini 2019-09-25 12:35:34
imagine user model has some appends.
SM_NHosseini 2019-09-25 12:35:53
but when I use this query I want to disable it’s appends :
SM_NHosseini 2019-09-25 12:36:35
Role::where(‘name’, OWNER)->whereHas(‘users’)->with(‘users’)->paginate($perPage);
goodluckalltheway 2019-09-25 12:47:10
SM_NHosseini 2019-09-25 12:36:35
Role::where(‘name’, OWNER)->whereHas(‘users’)->with(‘users’)->paginate($perPage);

Am not sure if it works with pagination but try this
$roles = Role::where(‘name’, OWNER)
->whereHas(‘users’)
->with(‘users’)
->get()
->each
->setAppends([]);

SM_NHosseini 2019-09-25 13:00:48
goodluckalltheway 2019-09-25 12:47:10
Am not sure if it works with pagination but try this
$roles = Role::where(‘name’, OWNER)
->whereHas(‘users’)
->with(‘users’)
->get()
->each
->setAppends([]);

didn’t work on get()

SM_NHosseini 2019-09-25 13:01:11
Undefined property: Illuminate\Database\Eloquent\Builder::$each
goodluckalltheway 2019-09-25 13:11:06
SM_NHosseini 2019-09-25 13:01:11
Undefined property: Illuminate\Database\Eloquent\Builder::$each

This is for high order messaging

goodluckalltheway 2019-09-25 13:11:19
Yes this should work
SM_NHosseini 2019-09-25 13:36:17
I’ll check and let you know , thanks.
PHP Begginer 2019-09-25 15:24:23
Hi , I am trying to access the page but i get the following message Call to a member function count() on null point on this page fashion-shopresourcesviewssitepagesproduct.blade.php)
PHP Begginer 2019-09-25 15:29:44
Resolved
Omidmm16 2019-09-25 16:28:42
hi guys , I hope you are good ,
I have a problem in programming with my app .
please help me .
in regular for store user (unknown user , guest user ) data like ( cart_sessionid, currency_session_id, language_session_id, …)in session , and get session id from users browser,
but I want to doing this structure in Api restful. (stateless).
my opinion , I have to create payload data like jwt payload for store all user data then in all request transfer between client and server .

๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™๐Ÿ™

shubhamdhyani 2019-09-25 17:17:30
laravel_discuss-14161.jpg

shubhamdhyani 2019-09-25 17:17:45
..
RanjanVns 2019-09-25 17:26:47
เค—เคพเคกเฅ€ เคตเคพเคฒเคพ เค†เคฏเคพ เค˜เคฐ เคธเฅ‡ เค•เคšเคฐเคพ เคจเคฟเค•เคพเคฒ
2019-09-25 17:28:18
Hi Everyone, I’m running a laravel app inside docker, one of my controllers executes an exe file but it doesn’t run the exe file
|