1 | <?php |
||||
2 | |||||
3 | namespace Raystech\StarterKit\Http\Controllers; |
||||
4 | |||||
5 | use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
||||
6 | use Illuminate\Foundation\Bus\DispatchesJobs; |
||||
7 | use Illuminate\Foundation\Validation\ValidatesRequests; |
||||
8 | use Illuminate\Routing\Controller as BaseController; |
||||
9 | use Illuminate\Http\Request; |
||||
10 | |||||
11 | use Raystech\StarterKit\Traits\Crudable; |
||||
12 | use Raystech\StarterKit\Models\Post; |
||||
13 | use Raystech\StarterKit\Models\Term; |
||||
14 | use Raystech\StarterKit\Models\TermTaxonomy; |
||||
15 | |||||
16 | class PostController extends BaseController |
||||
17 | { |
||||
18 | use AuthorizesRequests, DispatchesJobs, ValidatesRequests; |
||||
19 | |||||
20 | use Crudable; |
||||
21 | const ADD_MESSAGE = 'Added Successfully!'; |
||||
22 | const DELETE_MESSAGE = 'Deleted Successfully!'; |
||||
23 | const UPDATE_MESSAGE = 'Updated Successfully!'; |
||||
24 | |||||
25 | public function index() { |
||||
26 | // return self::ADD_MESSAGE; |
||||
27 | $posts = Post::orderBy('created_at')->get(); |
||||
28 | return view('rt-starter-kit::posts.index', compact('posts')); |
||||
29 | } |
||||
30 | |||||
31 | public function create(Request $request) { |
||||
0 ignored issues
–
show
|
|||||
32 | $posts = Post::orderBy('created_at')->get(); |
||||
33 | |||||
34 | flashtoast()->success('Create Post'); |
||||
35 | return view('rt-starter-kit::posts.create', compact('posts')); |
||||
36 | } |
||||
37 | |||||
38 | public function store(Request $request) |
||||
39 | { |
||||
40 | $request->validate([ |
||||
41 | 'post_title' => 'required', |
||||
42 | 'post_content' => 'required', |
||||
43 | 'submit' => 'required' |
||||
44 | ]); |
||||
45 | $current_time = Carbon::now(); |
||||
0 ignored issues
–
show
The type
Raystech\StarterKit\Http\Controllers\Carbon was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
46 | $post = Post::create([ |
||||
47 | 'post_author' => Auth::user()->id, |
||||
0 ignored issues
–
show
|
|||||
48 | 'post_content' => $request->get('post_content'), |
||||
49 | 'post_title' => $request->get('post_title'), |
||||
50 | 'post_excerpt' => '', |
||||
51 | 'post_status' => $request->get('submit'), |
||||
52 | 'post_password' => '', |
||||
53 | 'to_ping' => '', |
||||
54 | 'pinged' => '', |
||||
55 | 'post_content_filtered' => '', |
||||
56 | 'guid' => '', |
||||
57 | 'post_mime_type' => '', |
||||
58 | // 'post_name' => $request->get('slug') |
||||
59 | ]); |
||||
60 | $guid = option('site_url') . "/post/{$post->id}"; |
||||
0 ignored issues
–
show
The function
option was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
61 | $post->guid = $guid; |
||||
0 ignored issues
–
show
|
|||||
62 | $post->save(); |
||||
63 | |||||
64 | return redirect()->route('posts.edit', $post->id); |
||||
65 | } |
||||
66 | |||||
67 | public function show(Post $post) |
||||
68 | { |
||||
69 | // $post = Post::findOrFail($id); |
||||
70 | return view('rt-starter-kit::posts.show', compact(['post'])); |
||||
71 | } |
||||
72 | |||||
73 | public function edit($id) |
||||
74 | { |
||||
75 | $post = Post::find($id); |
||||
76 | $taxonomies = TermTaxonomy::where('taxonomy', 'like', 'property_%')->where('parent', 0)->get(); |
||||
77 | return view('rt-starter-kit::posts.edit', compact(['post', 'taxonomies'])); |
||||
78 | } |
||||
79 | } |
||||
80 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.