Laravel_api/app/Http/Controllers/Api/UrlController.php

27 lines
683 B
PHP
Raw Normal View History

2022-09-14 18:19:38 +08:00
<?php
namespace App\Http\Controllers\Api;
use App\Http\Requests\Api\UserRequest;
use App\Http\Resources\Api\UserResource;
use App\Jobs\Api\SaveLastTokenJob;
use App\Models\Book;
use App\Models\Url;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Tymon\JWTAuth\Exceptions\TokenExpiredException;
class UrlController extends Controller
{
public function index(){
$urls = Url::all();
return $this->success($urls);
}
public function add(Request $req){
$urls = new Url;
//dd($req["name"]);
$urls->host="www";
$urls->url="www.baidu.com";
$urls->save();
return $this->success($urls);
}
}