2022-07-07 17:14:40 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
2022-07-08 17:04:09 +08:00
|
|
|
use App\Models\Link;
|
|
|
|
|
2022-07-08 16:21:20 +08:00
|
|
|
class UController extends ApiController
|
2022-07-07 17:14:40 +08:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Display a listing of the resource.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function index($id)
|
|
|
|
{
|
|
|
|
//
|
2022-07-08 17:25:26 +08:00
|
|
|
$link = Link::where('id',$id)->first();
|
|
|
|
return base64_encode($link['url']);
|
|
|
|
|
2022-07-07 17:14:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Store a newly created resource in storage.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function store(Request $request)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the specified resource.
|
|
|
|
*
|
|
|
|
* @param int $id
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function show($id)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the specified resource in storage.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param int $id
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function update(Request $request, $id)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the specified resource from storage.
|
|
|
|
*
|
|
|
|
* @param int $id
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function destroy($id)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
2022-07-08 17:25:26 +08:00
|
|
|
public function add(Request $request)
|
2022-07-07 17:14:40 +08:00
|
|
|
{
|
|
|
|
//
|
2022-07-08 17:25:26 +08:00
|
|
|
$data = $request->all();
|
|
|
|
$link = Link::create(['url' => $data['url']]);
|
|
|
|
return $this->create('请求成功',200,$link);
|
2022-07-07 17:14:40 +08:00
|
|
|
|
|
|
|
}
|
2022-07-08 16:21:20 +08:00
|
|
|
public function text(Request $request)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
//return json_encode($request);
|
2022-07-08 17:04:09 +08:00
|
|
|
$data = $request->all();
|
|
|
|
$link = Link::where('id',$data['id'])->first();
|
|
|
|
return $this->create('请求成功',200,$link);
|
2022-07-08 16:21:20 +08:00
|
|
|
}
|
2022-07-07 17:14:40 +08:00
|
|
|
}
|