1 | <?php |
||
26 | class ProjectsController extends Controller |
||
27 | { |
||
28 | /** |
||
29 | * Display a listing of the resource. |
||
30 | * |
||
31 | * @return \Illuminate\Http\Response |
||
32 | */ |
||
33 | public function indexAction() |
||
38 | |||
39 | /** |
||
40 | * Show the form or adding a new resource. |
||
41 | * |
||
42 | * return \Illuminate\Http\Response |
||
43 | */ |
||
44 | public function newAction() |
||
51 | |||
52 | /** |
||
53 | * Show the form for creating a new resource. |
||
54 | * |
||
55 | * @return \Illuminate\Http\Response |
||
56 | */ |
||
57 | public function createAction() |
||
58 | { |
||
59 | // |
||
60 | $projectData = Request::get('project'); |
||
61 | $tags = array_pull($projectData, 'tags'); |
||
62 | |||
63 | try { |
||
64 | $projectData['creator_id'] = Auth::user()->id; |
||
65 | $project = $this->dispatchFromArray(AddProjectCommand::class, $projectData); |
||
66 | } catch (ValidationException $e) { |
||
67 | return Redirect::route('projects.new') |
||
68 | ->withInput(Request::all()) |
||
69 | ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.projects.new.failure'))) |
||
70 | ->withErrors($e->getMessageBag()); |
||
71 | } |
||
72 | |||
73 | // The project was added successfully, so now let's deal with the tags. |
||
74 | $tags = preg_split('/ ?, ?/', $tags); |
||
75 | |||
76 | // For every tag, do we need to create it? |
||
77 | $projectTags = array_map(function ($taggable) use ($project) { |
||
78 | return Tag::firstOrCreate(['name' => $taggable])->id; |
||
|
|||
79 | }, $tags); |
||
80 | |||
81 | $project->tags()->sync($projectTags); |
||
82 | |||
83 | return Redirect::route('dashboard.projects.index') |
||
84 | ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.projects.new.success'))); |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * Display the specified resource. |
||
89 | * |
||
90 | * @param string $owner |
||
91 | * @param string $project_path |
||
92 | * |
||
93 | * @return \Illuminate\Http\Response |
||
94 | */ |
||
95 | public function showAction($owner_path, $project_path) |
||
110 | |||
111 | /** |
||
112 | * Show the form for editing the specified resource. |
||
113 | * |
||
114 | * @param string $owner_path |
||
115 | * @param string $project_path |
||
116 | * |
||
117 | * @return \Illuminate\Http\Response |
||
118 | */ |
||
119 | public function editAction($owner_path, $project_path) |
||
130 | |||
131 | /** |
||
132 | * Update the specified resource in storage. |
||
133 | * |
||
134 | * @param string $owner_path |
||
135 | * @param string $project_path |
||
136 | * |
||
137 | * @return \Illuminate\Http\Response |
||
138 | */ |
||
139 | public function updateAction($owner_path, $project_path) |
||
163 | } |
||
164 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.