How we should properly handle exceptions in laravel when creating an api and we want to throw custom exceptions?

|
saulreyes 2019-01-30 19:20:32
htoowaikhant 2019-01-30 19:12:25
tell your problem details

I was trying to operate a button with JavaScript and when I passed it to my browser in the console I got “request from another blocked source (missing the CORS header)”

saulreyes 2019-01-30 19:20:36
😭😭😭😭😭🙏🏻🙏🏻🙏🏻
saulreyes 2019-01-30 19:20:41
Help!
htoowaikhant 2019-01-30 19:24:25
check it out https://github.com/barryvdh/laravel-cors

GitHub – fruitcake/laravel-cors: Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel applicationGitHub
Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application – GitHub – fruitcake/laravel-cors: Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel ap…
saulreyes 2019-01-30 19:36:54
Ok! Thanks 🙏🏻
2019-01-31 01:16:05
Hey guys, what’s the best CRM system for laravel u have been using? I started using October cms but not sure about it still
Lalesluc 2019-01-31 01:25:09
Interesting question !!! I have an eye in this @diashimself
easemashko 2019-01-31 02:59:38
Hello. What about antipatterns in Laravel?
Nikunj Sathawara 2019-01-31 06:24:09
2019-01-31 01:16:05
Hey guys, what’s the best CRM system for laravel u have been using? I started using October cms but not sure about it still

Asgard

sonvisalpv 2019-01-31 06:26:36
good morning all i have question about datatable export in laravel. i can not put it.
basha_97 2019-01-31 06:30:04
sonvisalpv 2019-01-31 06:26:36
good morning all i have question about datatable export in laravel. i can not put it.

Are you using jquery or other!!!

sonvisalpv 2019-01-31 06:30:13
yes
basha_97 2019-01-31 06:31:05
If you’re using jquery no problem it can be done easily
basha_97 2019-01-31 06:32:39
Refer this it will helpful
https://github.com/freshbitsweb/laratables

GitHub – freshbitsweb/laratables: Ajax support of DataTables (Laravel 5.5 to Laravel 8.x)GitHub
Ajax support of DataTables (Laravel 5.5 to Laravel 8.x) – GitHub – freshbitsweb/laratables: Ajax support of DataTables (Laravel 5.5 to Laravel 8.x)
sonvisalpv 2019-01-31 06:33:03
late me test
htoowaikhant 2019-01-31 06:42:07
sonvisalpv 2019-01-31 06:26:36
good morning all i have question about datatable export in laravel. i can not put it.

check it. http://yajrabox.com/docs/laravel-datatables/master/installation . there has csv export are completely fine , but pdf export is little sensitive.

Installation – Laravel DataTables YajraBoxYajrabox
Installation laravel-datatables package documentation.
htoowaikhant 2019-01-31 06:43:53
they are using snappy pdf. u can change to anothe pdf like tcpdf or dom.
imtiazsakib 2019-01-31 07:02:16
rthirty rrttedrd retxtddrdi
tjidrtdet
razaririr 2019-01-31 07:20:38
Hello to all . I am from Iran .
I wanted to ask, can I work in your country in absentia?
razaririr 2019-01-31 07:22:48
I’m very happy to talk to you.
2019-01-31 08:19:51
hi to all
2019-01-31 08:20:54
I wanna ask a question . can I user Lavalite to make a classified website or I have to create all by my own ?
hazhir 2019-01-31 11:39:04
htoowaikhant 2019-01-30 16:51:33
r u using this ? https://github.com/tymondesigns/jwt-auth

Yes

hazhir 2019-01-31 15:35:45
hazhir 2019-01-30 16:49:45
Hello every one, i’m developing an ecommerce API with laravel , i’m using JWT as the Authentication system in laravel.now i want to distinguish normal users from admins so just admins for example can create and store products and categories , does any one know what is the best solution to accomplish this task?
Thanks in Advance

The best solution is to use middleware!

hazhir 2019-01-31 15:35:55
If someone need it
hazhir 2019-01-31 15:36:46
How we should properly handle exceptions in laravel when creating an api and we want to throw custom exceptions?
latief52 2019-01-31 15:54:45
hazhir 2019-01-31 15:36:46
How we should properly handle exceptions in laravel when creating an api and we want to throw custom exceptions?

https://gitlab.com/latief/laravel55-api-skeleton

Sign inGitLab
latief52 2019-01-31 15:55:41
you can see on AppExceptionhandler.php
hazhir 2019-01-31 15:59:52
latief52 2019-01-31 15:54:45
https://gitlab.com/latief/laravel55-api-skeleton

Thank you for your response , i think the link is broken , 404

latief52 2019-01-31 16:00:56
hazhir 2019-01-31 15:59:52
Thank you for your response , i think the link is broken , 404

maybe permission, wait

hazhir 2019-01-31 16:01:04
latief52 2019-01-31 16:00:56
maybe permission, wait

Ok

latief52 2019-01-31 16:02:32
hazhir 2019-01-31 16:01:04
Ok

done, check again

hazhir 2019-01-31 17:25:28
latief52 2019-01-31 16:02:32
done, check again

thank you i can see it but i don’t know what you have done differently where should i check out exactly , thank you for your time 🙏

latief52 2019-01-31 17:40:04
hazhir 2019-01-31 17:25:28
thank you i can see it but i don’t know what you have done differently where should i check out exactly , thank you for your time 🙏

there is a process to handle, an error for the route with prefix api (domain/api), and it is handled by the trait, that’s why there is a trait in the appExceptionhandler.php, the trait also handles response error for api route

sorry if my english is bad 🙏

hazhir 2019-01-31 17:45:11
latief52 2019-01-31 17:40:04
there is a process to handle, an error for the route with prefix api (domain/api), and it is handled by the trait, that’s why there is a trait in the appExceptionhandler.php, the trait also handles response error for api route

sorry if my english is bad 🙏

i got it , thanks man

davoodkhany72 2019-01-31 18:50:46
behtarin Amozesh mogadamati laravel kasi mitone moarefi kone
honarkar98 2019-01-31 21:44:02
Hi my frinds
We have an app with laravel and react.
Which header type we should use?
Currently, we’re using json/application. But how we can send files to API?
We must change files like image or video to byte64?
Silvana744 2019-01-31 21:56:55
How many requests per second can PHP handle? Is it possible to measure that?
Silvana744 2019-01-31 21:59:01
I’ve heard of 30000 requests per second at most. Is it true?
RdotDev 2019-01-31 22:07:07
Laravel 5.7, passport authentication Unauthorised error. Redirect to Login in Shared Server.
Working in Cloud and Local
hazhir 2019-02-01 00:17:41
honarkar98 2019-01-31 21:44:02
Hi my frinds
We have an app with laravel and react.
Which header type we should use?
Currently, we’re using json/application. But how we can send files to API?
We must change files like image or video to byte64?

I have the similar situation i’m working on creating an api with laravel and the front end with react right now i’m in the middle of API i have no idea how is that procedure ahould be done

hazhir 2019-02-01 00:19:08
Silvana744 2019-01-31 21:56:55
How many requests per second can PHP handle? Is it possible to measure that?

It is possible based on hardwares this thing would change also how you have coded! If you use pure php you get the most performance possible! If you use frameworks this performance definitely drops

StanleyMasinde 2019-02-01 09:02:04
Guys I need your opinion here.

Which is better? Creating pdfs on the backend ( this seems to take lots of time)

Or printing it on the front-end using JavaScript?

Let’s talk

sonvisalpv 2019-02-01 10:09:23
good evening all i has error like when i am move to another server
sonvisalpv 2019-02-01 10:09:53
vendor/autoload.php): failed to open stream: Operation not permitted in
dark_astral 2019-02-01 10:10:57
sonvisalpv 2019-02-01 10:09:53
vendor/autoload.php): failed to open stream: Operation not permitted in

make rights for folder

StanleyMasinde 2019-02-01 10:11:11
sonvisalpv 2019-02-01 10:09:53
vendor/autoload.php): failed to open stream: Operation not permitted in

Change ownership to www-data (the whole folder) then permissions to 744 for folders and 644 for files

StanleyMasinde 2019-02-01 10:12:13
The easiest way is
sudo chmod -R 777 /vendor
but that compromises security
Silvana744 2019-02-01 10:12:15
StanleyMasinde 2019-02-01 09:02:04
Guys I need your opinion here.

Which is better? Creating pdfs on the backend ( this seems to take lots of time)

Or printing it on the front-end using JavaScript?

Let’s talk

Put the pressure on your front end not the back end.

StanleyMasinde 2019-02-01 10:12:43
Silvana744 2019-02-01 10:12:15
Put the pressure on your front end not the back end.

I get your point thanks

|