Init(Core): add project to git and add seeders and factory
This commit is contained in:
22
app/Http/Controllers/Admin/ImageController.php
Normal file
22
app/Http/Controllers/Admin/ImageController.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Post;
|
||||
|
||||
class ImageController extends Controller
|
||||
{
|
||||
public function store(Request $request, Post $post)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'path' => 'required|string',
|
||||
'user_token' => 'required|string',
|
||||
]);
|
||||
|
||||
$content = $post->images()->create($validated);
|
||||
|
||||
return response(['message' => 'created', 'data' => $content]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user