Completed
Push — master ( b1a1a8...10b90e )
by David
27:55
created

PageController::showWithDetail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 11
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
1
<?php 
2
3
namespace App\Http\Controllers\Api\V1;
4
5
use App\Http\Controllers\Api\V1\ApiController;
6
use App\LaravelRestCms\Page\Page as Page;
7
8
class PageController extends ApiController
9
{
10
	/**
11
	 * The name of the model to use for this package
12
	 * 
13
	 * @var string
14
	 */
15
	protected $modelName = \App\LaravelRestCms\Page\Page::class;
16
    
17
	/**
18
	 * The name of the transformer to use for this package
19
	 * 
20
	 * @var string
21
	 */
22
	protected $transformerName = \App\LaravelRestCms\Page\PageTransformer::class;
23
    
24
	/**
25
	 * The key to use as a key for this collection in the output
26
	 * 
27
	 * @var string
28
	 */
29
	protected $collectionName = 'pages';
30
31
	/**
32
	 * The methods that don't require api authentication
33
	 * 
34
	 * @var array
35
	 */
36
	protected $apiMethods = [
37
		'showBySlug' => [
38
			'keyAuthentication' => false
39
		],
40
	];
41
42
    /**
43
     * Returns a page and associated detail and template data
44
     * 
45
     * @param  string $slug
46
     * @return \Illuminate\Http\JsonResponse
47
     */
48
    public function showBySlug($slug)
49
    {        
50
        return $this->showWithDetail(['url' => $slug]);
51
    }
52
53
    /**
54
     * Returns a page and associated detail and template data
55
     * 
56
     * @param  mixed $id
57
     * @return \Illuminate\Http\JsonResponse
58
     */
59
    public function showWithDetail($id)
60
    {        
61
        $this->manager->parseIncludes([
62
        	'parent',
63
        	'detail',
64
        	'detail.template_detail',
65
        	//'detail.template_detail.parent',
66
        ]);
67
68
        return $this->show($id);
69
    }
70
71
}