2020-06-09 07:05:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2020-06-22 08:08:18 +00:00
|
|
|
use App\ExternalLink;
|
2020-06-09 07:05:07 +00:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
class ExternalLinkController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Display a listing of the resource.
|
|
|
|
*
|
2020-06-22 08:08:18 +00:00
|
|
|
* @param Request $request
|
|
|
|
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
2020-06-09 07:05:07 +00:00
|
|
|
*/
|
2020-06-22 08:08:18 +00:00
|
|
|
public function index(Request $request)
|
2020-06-09 07:05:07 +00:00
|
|
|
{
|
2020-06-22 08:08:18 +00:00
|
|
|
$externalLink = ExternalLink::query()->paginate($request->input("limit", 20));
|
|
|
|
|
2020-06-22 12:53:00 +00:00
|
|
|
return view("external-links.index", [ "externalLink" => $externalLink ]);
|
2020-06-09 07:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the form for creating a new resource.
|
|
|
|
*
|
2020-06-22 12:53:00 +00:00
|
|
|
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
2020-06-09 07:05:07 +00:00
|
|
|
*/
|
|
|
|
public function create()
|
|
|
|
{
|
2020-06-22 12:53:00 +00:00
|
|
|
return view("external-links.create");
|
2020-06-09 07:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Store a newly created resource in storage.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
2020-06-22 12:53:00 +00:00
|
|
|
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
2020-06-09 07:05:07 +00:00
|
|
|
*/
|
|
|
|
public function store(Request $request)
|
|
|
|
{
|
2020-06-22 12:53:00 +00:00
|
|
|
$requestBody = $request->validate([
|
|
|
|
"name" => "required|max:255",
|
|
|
|
"link" => "required|max:255"
|
|
|
|
]);
|
|
|
|
|
|
|
|
$externalLink = new ExternalLink($requestBody);
|
|
|
|
$externalLink->save();
|
|
|
|
|
|
|
|
return view("external-links.store");
|
2020-06-09 07:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|