mirror of
https://github.com/linuxserver/Heimdall.git
synced 2026-02-22 04:30:32 +09:00
106 lines
2.1 KiB
PHP
106 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Item;
|
|
use App\SettingUser;
|
|
use App\User;
|
|
|
|
class ApiItemController extends Controller
|
|
{
|
|
protected $api_key;
|
|
protected $user;
|
|
|
|
function __construct(Request $request) {
|
|
$this->middleware('apikey');
|
|
|
|
$key = $request->input('api_key');
|
|
if ($key) {
|
|
$details = SettingUser::where('setting_id', 12)->where('uservalue', $key)->first();
|
|
$this->api_key = $key;
|
|
$this->user = User::find($details->user_id);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
return $this->user->items;
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
$request->merge([
|
|
'user_id' => $this->user->id
|
|
]);
|
|
// die(print_r($request->all()));
|
|
Item::create($request->all());
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function edit($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)
|
|
{
|
|
//
|
|
}
|
|
}
|