45 lines
948 B
PHP
45 lines
948 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Resources\BrandCollection;
|
|
use App\Http\Resources\BrandResource;
|
|
use App\Http\Resources\UrlCollection;
|
|
use App\Models\Brand;
|
|
use Illuminate\Http\Request;
|
|
|
|
class BrandController extends Controller
|
|
{
|
|
/**
|
|
* Returns a listing of the brands.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
return new BrandCollection(Brand::all());
|
|
}
|
|
|
|
/**
|
|
* Returns the specified brand.
|
|
*
|
|
* @param Brand $brand
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show(Brand $brand)
|
|
{
|
|
return new BrandResource($brand);
|
|
}
|
|
|
|
/**
|
|
* Returns the urls for a given brand.
|
|
*
|
|
* @param Brand $brand
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function getUrls(Brand $brand)
|
|
{
|
|
return new UrlCollection($brand->urls);
|
|
}
|
|
}
|