Commit 99374091 authored by Mohammad Javad Ghasemy's avatar Mohammad Javad Ghasemy 🦈

add Api for search book detail by isbn

parent 00e35c0f
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use BookByISBN\Ketabir;
use BookByISBN\OpacNlai;
class BookByISBN extends Controller
{
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($_isbn)
{
$ketabir = new Ketabir($_isbn);
$opac = new OpacNlai();
$opac_detail = $opac->get_book_detail($_isbn);
$status_code = empty($ketabir->book_picture) ? false : true;
return ["ok" => $status_code, "ketabir" => (array) $ketabir, "opac" => $opac_detail];
}
}
......@@ -22,10 +22,9 @@ class RedirectIfAuthenticated
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
return redirect(RouteServiceProvider::DASHBOARD);
}
}
return $next($request);
}
}
......@@ -15,7 +15,7 @@
{{Form::label('isbn', "ISBN")}}
<div class="row">
<div class="col-9">
{{Form::text('isbn', '', ['id' => 'ISBN','class' => 'form-control', 'placeholder' => '121212121'])}}
{{Form::text('isbn', '', ['id' => 'ISBN','class' => 'form-control', 'placeholder' => '964-2793-03-2'])}}
</div>
<div class="col-3">
......
......@@ -17,3 +17,5 @@ use Illuminate\Support\Facades\Route;
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('/isbn/{isbn}', [\App\Http\Controllers\API\BookByISBN::class, 'show']);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment