basic profile edit page, not working yet
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
@@ -11,7 +10,7 @@ class UserController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Show the application dashboard.
|
* Show the application dashboard.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function view(User $user)
|
public function view(User $user)
|
||||||
{
|
{
|
||||||
@@ -21,4 +20,20 @@ class UserController extends Controller
|
|||||||
|
|
||||||
return view('user.view')->with(compact('tables', 'user'));
|
return view('user.view')->with(compact('tables', 'user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit user profile
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @return \Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
return view('user.edit')->with('user', \Auth::user());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store()
|
||||||
|
{
|
||||||
|
echo "Not impl";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use MightyPork\Exceptions\NotExistException;
|
|||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $name - unique, for vanity URL
|
* @property string $name - unique, for vanity URL
|
||||||
* @property string $title - for display
|
* @property string $title - for display
|
||||||
|
* @property string $bio - user bio
|
||||||
* @property string $email - unique, for login and social auth chaining
|
* @property string $email - unique, for login and social auth chaining
|
||||||
* @property string $password - hashed pw
|
* @property string $password - hashed pw
|
||||||
* @property bool $confirmed - user e-mail is confirmed
|
* @property bool $confirmed - user e-mail is confirmed
|
||||||
|
|||||||
@@ -14,6 +14,20 @@ class WidgetFactory
|
|||||||
$this->fieldCols = $fieldCols;
|
$this->fieldCols = $fieldCols;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function header($hx, $text)
|
||||||
|
{
|
||||||
|
return "<div class=\"row\">".
|
||||||
|
"<h$hx class=\"col-md-$this->fieldCols offset-md-$this->labelCols\">".e($text)."</h$hx>".
|
||||||
|
"</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function par($text)
|
||||||
|
{
|
||||||
|
return "<div class=\"row\">".
|
||||||
|
"<p class=\"col-md-$this->fieldCols offset-md-$this->labelCols\">".e($text)."</o>".
|
||||||
|
"</div>";
|
||||||
|
}
|
||||||
|
|
||||||
private function baseWidget($view, $name, $label)
|
private function baseWidget($view, $name, $label)
|
||||||
{
|
{
|
||||||
return (new Widget($view, $name, $label))->layout($this->labelCols, $this->fieldCols);
|
return (new Widget($view, $name, $label))->layout($this->labelCols, $this->fieldCols);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class CreateEmailConfirmationsTable extends Migration
|
|||||||
Schema::create('email_confirmations', function (Blueprint $table) {
|
Schema::create('email_confirmations', function (Blueprint $table) {
|
||||||
$table->unsignedInteger('user_id')->index();
|
$table->unsignedInteger('user_id')->index();
|
||||||
$table->timestamp('created_at')->nullable();
|
$table->timestamp('created_at')->nullable();
|
||||||
|
$table->string('email');
|
||||||
$table->string('token');
|
$table->string('token');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
some symbols are allowed. You can always change this later.') !!}
|
some symbols are allowed. You can always change this later.') !!}
|
||||||
|
|
||||||
{!! Widget::email('email', 'E-Mail Address')->required()->autofocus()
|
{!! Widget::email('email', 'E-Mail Address')->required()->autofocus()
|
||||||
->help('Used to login and for password reset e-mails') !!}
|
->help('Used to login and for password resets') !!}
|
||||||
|
|
||||||
{!! Widget::password('password', 'Password')->required() !!}
|
{!! Widget::password('password', 'Password')->required() !!}
|
||||||
{!! Widget::password('password_confirmation', 'Confirm Password')->required() !!}
|
{!! Widget::password('password_confirmation', 'Confirm Password')->required() !!}
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,11 @@
|
|||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||||
<a class="dropdown-item" href="{{ route('logout') }}"
|
<a class="dropdown-item" href="{{ route('logout') }}"
|
||||||
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
|
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
|
||||||
<i class="fa-sign-out fa-pr"></i>{{--
|
<i class="fa-sign-out fa-pr"></i>{{ __('Logout') }}
|
||||||
--}}{{ __('Logout') }}
|
</a>
|
||||||
|
|
||||||
|
<a class="dropdown-item" href="{{ route('user.edit') }}">
|
||||||
|
<i class="fa-sliders fa-pr"></i>{{ __('Settings') }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
|
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
|
||||||
|
|||||||
@@ -4,20 +4,14 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="row">
|
|
||||||
<h2 class="col-md-8 offset-md-3">New Table</h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="POST" action="{{route('table.storeNew')}}" class="row justify-content-center"
|
<form method="POST" action="{{route('table.storeNew')}}" class="row justify-content-center"
|
||||||
aria-label="New Table">
|
aria-label="New Table">
|
||||||
|
|
||||||
@csrf
|
@csrf
|
||||||
<div class="col-md-8">
|
<div class="col-md-10">
|
||||||
@php(Widget::setLayout(3, 8))
|
@php(Widget::setLayout(3, 7))
|
||||||
|
|
||||||
|
{!! Widget::header(1, 'New Table') !!}
|
||||||
|
|
||||||
{!! Widget::text('title', 'Title')->autoAlias('name', '-')
|
{!! Widget::text('title', 'Title')->autoAlias('name', '-')
|
||||||
->help('Unique among your tables') !!}
|
->help('Unique among your tables') !!}
|
||||||
@@ -54,7 +48,7 @@
|
|||||||
specification you entered above.') !!}
|
specification you entered above.') !!}
|
||||||
|
|
||||||
<div class="row form-group">
|
<div class="row form-group">
|
||||||
<div class="col-md-8 offset-md-3">
|
<div class="col-md-7 offset-md-3">
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
<i class="fa-save pr-2"></i>Create Table
|
<i class="fa-save pr-2"></i>Create Table
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
|
||||||
<div class="col-md-8">
|
<div class="col-md-10">
|
||||||
<table class="table table-hover table-sm">
|
<table class="table table-hover table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
{{-- Profile edit form --}}
|
||||||
|
|
||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<form method="POST" action="{{route('user.store')}}" class="row justify-content-center"
|
||||||
|
aria-label="Your Profile">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div class="col-md-10">
|
||||||
|
@php(Widget::setLayout(3, 7))
|
||||||
|
|
||||||
|
{!! Widget::header(1, 'Settings') !!}
|
||||||
|
|
||||||
|
{!! Widget::text('title', 'Display Name')->value($user->title)->required()->autofocus()
|
||||||
|
->help('Shown on your profile page, tables, comments, etc.') !!}
|
||||||
|
|
||||||
|
{!! Widget::textarea('bio', 'About Me')->value($user->bio)->required()->height('8em')
|
||||||
|
->help('This is shown in your profile box') !!}
|
||||||
|
|
||||||
|
{!! Widget::text('name', 'Username')->value($user->name)->required()
|
||||||
|
->prepend('@')
|
||||||
|
->help('Part of your vanity URL. Caution: changing this will alter URLs of your tables.') !!}
|
||||||
|
|
||||||
|
{!! Widget::email('email', 'E-Mail Address')->value($user->email)->required()
|
||||||
|
->help('Used to login and for password resets.
|
||||||
|
This field is protected; a change will be applied only after you confirm
|
||||||
|
the new e-mail address via a confirmation link we\'ll send you to it.') !!}
|
||||||
|
|
||||||
|
{!! Widget::header(3, 'Password Change') !!}
|
||||||
|
{!! Widget::par('Leave empty to keep your current password (if any).') !!}
|
||||||
|
|
||||||
|
{!! Widget::password('new_password', 'New Password') !!}
|
||||||
|
|
||||||
|
{!! Widget::password('new_password_confirmation', 'Confirm New Password') !!}
|
||||||
|
|
||||||
|
<div class="row form-group">
|
||||||
|
<div class="col-md-7 offset-md-3">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
<i class="fa-save pr-2"></i>Apply Changes
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@@ -31,6 +31,7 @@ Route::group(['middleware' => 'auth'], function () {
|
|||||||
'prefix' => 'user',
|
'prefix' => 'user',
|
||||||
], function () {
|
], function () {
|
||||||
Route::get('edit', 'UserController@edit')->name('user.edit');
|
Route::get('edit', 'UserController@edit')->name('user.edit');
|
||||||
|
Route::post('edit', 'UserController@store')->name('user.store');
|
||||||
Route::post('create', 'TableController@storeNew')->name('table.storeNew');
|
Route::post('create', 'TableController@storeNew')->name('table.storeNew');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user