add api url in env
This commit is contained in:
@@ -8,30 +8,33 @@ use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
public function login()
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'kodlaluan' => 'required|string',
|
||||
'katalaluan' => 'required|string',
|
||||
]);
|
||||
|
||||
$credentials = $request->only('kodlaluan', 'katalaluan');
|
||||
|
||||
if (Auth::attempt($credentials)) {
|
||||
return redirect()->intended('home');
|
||||
}
|
||||
|
||||
return redirect('login')->with('error', 'Oppes! You have entered invalid credentials');
|
||||
}
|
||||
|
||||
public function logout() {
|
||||
Auth::logout();
|
||||
|
||||
return redirect('/');
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Config;
|
||||
|
||||
use App\Customer;
|
||||
use App\Media;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -33,7 +35,9 @@ class CustomersController extends Controller
|
||||
|
||||
public function search(Request $request){
|
||||
$noic = $request->noic;
|
||||
$customer_info = $this->customerService->getCustomerInfo($noic);
|
||||
|
||||
$customer_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json();
|
||||
// dd($customer_info);
|
||||
$search = true;
|
||||
if($customer_info){
|
||||
Session::put('customer_info',$customer_info);
|
||||
|
||||
Reference in New Issue
Block a user