mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update StatusController
This commit is contained in:
parent
184097893e
commit
943f158882
1 changed files with 16 additions and 2 deletions
|
@ -4,10 +4,24 @@ namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\{Media, Status, User};
|
use App\{Media, Profile, Status, User};
|
||||||
|
use Vinkla\Hashids\Facades\Hashids;
|
||||||
|
|
||||||
class StatusController extends Controller
|
class StatusController extends Controller
|
||||||
{
|
{
|
||||||
|
public function show(Request $request, $username, $hashid)
|
||||||
|
{
|
||||||
|
$user = Profile::whereUsername($username)->firstOrFail();
|
||||||
|
$id = Hashids::decode($hashid);
|
||||||
|
if(empty($id)) {
|
||||||
|
abort(404);
|
||||||
|
} else {
|
||||||
|
$id = $id[0];
|
||||||
|
}
|
||||||
|
$status = Status::whereProfileId($user->id)->findOrFail($id);
|
||||||
|
return view('status.show', compact('user', 'status'));
|
||||||
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
if(Auth::check() == false)
|
if(Auth::check() == false)
|
||||||
|
@ -41,6 +55,6 @@ class StatusController extends Controller
|
||||||
$media->mime = $request->file('photo')->getClientMimeType();
|
$media->mime = $request->file('photo')->getClientMimeType();
|
||||||
$media->save();
|
$media->save();
|
||||||
|
|
||||||
return [$media, $request->all()];
|
return redirect($status->url());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue