I have a table with fields 'name', 'type' and 'amount', for example
|------------|-------|----------|
| name | type | amount |
|------------|-------|----------|
| Name_1 | 1 | 100 |
|------------|-------|----------|
| Name_1 | 2 | 200 |
|------------|-------|----------|
| Name_2 | 1 | 300 |
|------------|-------|----------|
| Name_1 | 1 | 400 |
|------------|-------|----------|
And I need to receive a result
|------------|---------------------------|--------------------------|
| name | sum(amount) of type 1 | sum(amount) of type 2 |
|------------|---------------------------|--------------------------|
| Name_1 | 500 (as 100 + 400) | 200 |
|------------|---------------------------|--------------------------|
| Name_2 | 300 | 0 |
|------------|---------------------------|--------------------------|
How can I do it with Laravel? Or with MySQL?
PS. As @Barmar say, the decision of a question is already found (need to return two sets of data with two different where clauses). But this is fully MySQL approach, also interest Laravel Eloquent decision.