src/controllers/LoginController.php
public function postIndex(Request $request) {
		//regular login
		if (DB::table(config('center.db.users'))->count()) {
			//attempt auth
			if (Auth::attempt(['email'=>$request->input('email'), 'password'=>$request->input('password')], true)) {

				DB::table(config('center.db.users'))->where('id', Auth::user()->id)->update([
					'last_login'=>new DateTime
				]);
												
				return redirect()->intended(action('\LeftRight\Center\Controllers\TableController@index'));
				
			}
			return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.login_invalid'));
		} 
		
		//installing, make user
		$user_id = DB::table(config('center.db.users'))->insertGetId([
			'name'			=> $request->input('name'),
			'email'			=> $request->input('email'),
			'password'		=> Hash::make($request->input('password')),
			'last_login'	=> new DateTime,
			'updated_at'	=> new DateTime,
			'updated_by'	=> 1,
		]);
				
		Auth::loginUsingId($user_id, true);

		return redirect()->action('\LeftRight\Center\Controllers\TableController@index');
	}
public function postIndex(Request $request) {
		//regular login
		if (DB::table(config('center.db.users'))->count()) {
			//attempt auth
			if (Auth::attempt(['email'=>$request->input('email'), 'password'=>$request->input('password')], true)) {

				DB::table(config('center.db.users'))->where('id', Auth::user()->id)->update([
					'last_login'=>new DateTime
				]);
												
				return redirect()->intended(action('\LeftRight\Center\Controllers\TableController@index'));
				
			}
			return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.login_invalid'));
		} 
		
		//installing, make user
		$user_id = DB::table(config('center.db.users'))->insertGetId([
			'name'			=> $request->input('name'),
			'email'			=> $request->input('email'),
			'password'		=> Hash::make($request->input('password')),
			'last_login'	=> new DateTime,
			'updated_at'	=> new DateTime,
			'updated_by'	=> 1,
		]);
				
		Auth::loginUsingId($user_id, true);

		return redirect()->action('\LeftRight\Center\Controllers\TableController@index');
	}
public function postIndex ( Request $ request ) { //regular login if ( DB :: table ( config ( 'center.db.users' ) ) -> count ( ) ) { //attempt auth if ( Auth :: attempt ( [ 'email' => $ request -> input ( 'email' ) , 'password' => $ request -> input ( 'password' ) ] , true ) ) { DB :: table ( config ( 'center.db.users' ) ) -> where ( 'id' , Auth :: user ( ) -> id ) -> update ( [ 'last_login' => new DateTime ] ) ; return redirect ( ) -> intended ( action ( '\LeftRight\Center\Controllers\TableController@index' ) ) ; } return redirect ( ) -> action ( '\LeftRight\Center\Controllers\TableController@index' ) -> with ( 'error' , trans ( 'center::site.login_invalid' ) ) ; } //installing, make user $ user_id = DB :: table ( config ( 'center.db.users' ) ) -> insertGetId ( [ 'name' => $ request -> input ( 'name' ) , 'email' => $ request -> input ( 'email' ) , 'password' => Hash :: make ( $ request -> input ( 'password' ) ) , 'last_login' => new DateTime , 'updated_at' => new DateTime , 'updated_by' => 1 , ] ) ; Auth :: loginUsingId ( $ user_id , true ) ; return redirect ( ) -> action ( '\LeftRight\Center\Controllers\TableController@index' ) ; }
handle a post to the login or install form
handle a post to the login or install form