1 | <?php |
||
5 | class HoleScoresController extends \BaseController { |
||
6 | |||
7 | public function __construct(HoleScore $holeScore) |
||
11 | |||
12 | /** |
||
13 | * Display a listing of the resource. |
||
14 | * |
||
15 | * @return Response |
||
16 | */ |
||
17 | public function index() |
||
22 | |||
23 | |||
24 | /** |
||
25 | * Show the form for creating a new resource. |
||
26 | * |
||
27 | * @return Response |
||
28 | */ |
||
29 | public function create() |
||
33 | |||
34 | |||
35 | /** |
||
36 | * Store a newly created resource in storage. |
||
37 | * |
||
38 | * @return Response |
||
39 | */ |
||
40 | public function store() |
||
44 | |||
45 | |||
46 | /** |
||
47 | * Display the specified resource. |
||
48 | * |
||
49 | * @param int $id |
||
50 | * @return Response |
||
51 | */ |
||
52 | public function show($id) |
||
56 | |||
57 | |||
58 | /** |
||
59 | * Show the form for editing the specified resource. |
||
60 | * |
||
61 | * @param int $id |
||
62 | * @return Response |
||
63 | */ |
||
64 | public function edit($id) |
||
68 | |||
69 | |||
70 | /** |
||
71 | * Update the specified resource in storage. |
||
72 | * |
||
73 | * @param int $id |
||
74 | * @return Response |
||
75 | */ |
||
76 | public function update($id) |
||
77 | { |
||
78 | $score = Input::get('score'); |
||
79 | $this->holeScore->update($id, $score); |
||
80 | } |
||
81 | |||
82 | |||
83 | /** |
||
84 | * Remove the specified resource from storage. |
||
85 | * |
||
86 | * @param int $id |
||
87 | * @return Response |
||
88 | */ |
||
89 | public function destroy($id) |
||
93 | |||
94 | |||
95 | } |
||
96 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: