How can I do the same login and registration form in same page. Like pinterest.com and login users immediately after registration.
I dont know how to do a Manual Authentication, just the default Auth\\AuthController
I have this controller, model and view.. throw me errors MethodNotAllowedHttpException in compiled.php line 7717:
model: publish.php
class Publish extends Model implements AuthenticatableContract, CanResetPasswordContract{
//
use Authenticatable, CanResetPassword;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'user_profiles';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['email', 'password'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
}
controller: PublishController
use App\Http\Controllers\Controller;
use App\Publicar;
use Auth;
use Request;
class PublishController extends Controller {
public function index()
{
return view('partials.loginCreate', compact('publish'));
}
public function authenticate()
{
if (Auth::attempt(['email' => $email, 'password' => $password]))
{
return redirect()->intended('dashboard');
}
}
view: login.blade.php
<form class="form-horizontal" role="form" method="POST" action="{{ url('/publish/authenticate') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="form-group">
<label class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
</div>
</div>
routes.php
Route::get('publish', 'PublishController@index');
Route::get('publish/authenticate', 'PublishController@authenticate');
Route::get('publishLogout', 'PublishController@destroy');
Change your route from
Route::get('publish/authenticate', 'PublishController@authenticate');
to
Route::post('publish/authenticate', 'PublishController@authenticate');
because you are posting some data when you are calling authenticate method but the route method you have chosen is get and hence you are getting MethodNotAllowed exception
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.