Pārlūkot izejas kodu

smerdgilisssssss

Администратор 6 gadi atpakaļ
vecāks
revīzija
60ccba4097

+ 54 - 0
app/Http/Controllers/ProfileController.php

@@ -0,0 +1,54 @@
+<?php
+
+
+namespace App\Http\Controllers;
+
+use App\Http\Controllers\Controller;
+use App\Models\Profile;
+use App\User;
+use Illuminate\Http\Request;
+use App\Models\Item;
+use App\Models\Picture;
+use Illuminate\Support\Facades\Auth;
+
+
+class ProfileController extends Controller
+{
+
+    public function index()
+    {
+
+        $contentContainer = '';
+
+        $profile = Profile::where('user_id', Auth::id())->first();
+        if ($profile) {
+            $contentContainer = (string)view('userprofile.profile_form', ['profile' => $profile]);
+        }
+
+        return view('userprofile.index', ["contentContainer" => $contentContainer]);
+    }
+
+
+    public function showAllItems(User $user = null)
+    {
+
+        $user = $user ?: Auth::user();
+
+        $userItemsList = Item::where('user_id', '=', $user->id)->get();
+        if (count($userItemsList) > 0) {
+            $userItemsList->load('picture');
+        }
+
+        return view('userprofile.index', ['itemsList' => $userItemsList]);
+
+    }
+
+    public function userProfileInfo()
+    {
+        $contentContainer = '';
+
+        $contentContainer = RegisterProfileController::createView();
+
+        return view('userprofile.index', ["contentContainer" => $contentContainer]);
+    }
+}

+ 56 - 0
app/Http/Controllers/RegisterProfileController.php

@@ -0,0 +1,56 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Http\Requests\ProfileRequest;
+use App\Models\Profile;
+use App\User;
+use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Input;
+
+
+class RegisterProfileController extends Controller
+{
+    public function create()
+    {
+        $profile = Profile::where('user_id', Auth::id())->first() ?? new Profile();
+        return view('userprofile.profile', ['profile' => $profile]);
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request $request
+     * @return \Illuminate\Http\Response
+     */
+
+    public function store(ProfileRequest $request)
+    {
+        $user = Auth::user();
+
+        if ($request->isMethod('POST')) {
+            $profile = Profile::where('user_id', Auth::id())->first();
+
+            if ($profile) {
+                $profile->fill($request->except('_token', 'submit'));
+                $profile->update();
+            }
+            if (!$profile) {
+                $profile = new Profile($request->all());
+                $profile->save();
+            }
+        }
+
+
+        return redirect()->route('home')->with(['message' => 'Профиль создан']);
+
+    }
+
+    public static function createView()
+    {
+        return self::create();
+    }
+
+}

+ 7 - 4
app/Http/Controllers/UsersItemController.php

@@ -23,10 +23,13 @@ class UsersItemController extends Controller
         $categories = Category::all();
         $subcategories = Subcategory::all();
 
-        return view('itemregister.item', [
-            'categories' => $categories,
-            'subcategories' => $subcategories,
-        ]);
+        return view('userprofile.index', [
+                'newItem' => true,
+                'categories' => $categories,
+                'subcategories' => $subcategories,
+            ]
+        );
+
     }
 
     public function store(StoreItemRequest $request)

+ 37 - 0
app/Http/Requests/ProfileRequest.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace App\Http\Requests;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class ProfileRequest extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return true;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+            'user_id' => 'required|integer|exists:users,id',
+            'name' => 'required|string|max:30',
+            'surname' => 'required|string|max:30',
+            'gender' => 'required',
+            'country' => 'required|string|max:40',
+            'city' => 'required|string|max:40 ',
+            'age' => 'required|integer|max:100',
+            'hobby' => 'required|string|max:70'
+        ];
+    }
+}

+ 28 - 0
app/Models/Profile.php

@@ -0,0 +1,28 @@
+<?php
+
+
+namespace App\Models;
+
+
+use Illuminate\Database\Eloquent\Model;
+
+class Profile extends Model
+{
+    public $timestamps = false;
+
+    protected $fillable = [
+        'name',
+        'user_id',
+        'surname',
+        'gender',
+        'country',
+        'city',
+        'age',
+        'hobby'
+    ];
+
+    public function user()
+    {
+        return $this->belongsTo('App\User');
+    }
+}

+ 1 - 1
database/migrations/2018_04_15_165539_create_items_exchange_table.php

@@ -36,7 +36,7 @@ class CreateItemsExchangeTable extends Migration
      */
     public function down()
     {
-        Schema::table('pictures', function (Blueprint $table) {
+        Schema::table('items_exchange', function (Blueprint $table) {
             $table->dropForeign(['item_id']);
             $table->dropForeign(['item_offer_id']);
         });

+ 47 - 0
database/migrations/2018_04_21_182224_create_profiles_table.php

@@ -0,0 +1,47 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateProfilesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('profiles', function (Blueprint $table) {
+            $table->increments('id');
+            $table->unsignedInteger('user_id')->unique();
+            $table->string('name');
+            $table->string('surname');
+            $table->enum('gender', ['m', 'f',null])->nullable();
+            $table->string('country');
+            $table->string('city');
+            $table->integer('age');
+            $table->string('hobby');
+
+
+            $table->foreign('user_id')
+                ->references('id')->on('users')
+                ->onDelete('cascade');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('profiles', function (Blueprint $table) {
+            $table->dropForeign(['user_id']);
+
+        });
+        Schema::dropIfExists('profiles');
+    }
+}

+ 3 - 3
resources/lang/en/validation.php

@@ -45,7 +45,7 @@ return [
     'image'                => 'The :attribute must be an image.',
     'in'                   => 'The selected :attribute is invalid.',
     'in_array'             => 'The :attribute field does not exist in :other.',
-    'integer'              => 'The :attribute must be an integer.',
+    'integer'              => 'Поле :attribute должно быть целочисленным.',
     'ip'                   => 'The :attribute must be a valid IP address.',
     'ipv4'                 => 'The :attribute must be a valid IPv4 address.',
     'ipv6'                 => 'The :attribute must be a valid IPv6 address.',
@@ -68,7 +68,7 @@ return [
     'numeric'              => 'The :attribute must be a number.',
     'present'              => 'The :attribute field must be present.',
     'regex'                => 'The :attribute format is invalid.',
-    'required'             => 'The :attribute field is required.',
+    'required'             => 'Поле :attribute необходимо для заполнения.',
     'required_if'          => 'The :attribute field is required when :other is :value.',
     'required_unless'      => 'The :attribute field is required unless :other is in :values.',
     'required_with'        => 'The :attribute field is required when :values is present.',
@@ -118,4 +118,4 @@ return [
 
     'attributes' => [],
 
-];
+];

+ 96 - 78
resources/views/itemregister/item.blade.php

@@ -1,87 +1,105 @@
-@extends('layouts.app')
+{{--@extends('layouts.app')--}}
 
-@section('navbar')
-@endsection
-@section('content')
+{{--@section('navbar')--}}
+{{--@endsection--}}
+{{--@section('content')--}}
 
-    <div class="container">
-        <div class="row">
-            <div class="col-md-6 col-md-offset-3" style="max-width:600px;min-width:600px;">
-                <div class="panel panel-primary">
-                    <div class="panel-heading">Предложить товар!</div>
-                    <div class="panel-body">
-                        <form method="POST" action="{{ route('item.store') }}">
-                            {{ csrf_field() }}
-                            <div class="form-group">
-                                <label for="caption">Заголовок</label>
-                                <input type="text" id="caption" class="form-control" name="caption"
-                                       placeholder="Название товара">
-                            </div>
-                            <div class="form-group">
-                                <label for="category">Выберите категорию</label>
-                                <select id="category" class="form-control" name="category_id"
-                                        onchange="loadSubcategory(this)">
-                                    @foreach($categories as $category)
-                                        <option value="{{$category->id}}">{{$category->title}}</option>
-                                        {{--<option value="1">{{$category}}</option>--}}
-                                    @endforeach
-                                </select>
-                                @if ($errors->has('category'))
-                                    <span class="invalid-feedback">
-                        <strong>{{ $errors->first('category') }}</strong>
-                    </span>b
-                                @endif
-                            </div>
-                            <div class="form-group">
-                                <label for="subcategory">Выберите подкатегорию</label>
-                                <select id="subcategory" class="form-control" name="subcategory_id">
-                                    @foreach($subcategories as $subcategory)
-                                        <option value="{{$subcategory->id}}">{{$subcategory->title}}</option>
-                                        {{--<option value="1">{{$subcategory}}</option>--}}
-                                    @endforeach
-                                </select>
-                            </div>
-                            <div class="form-group">
-                                <label for="description">Описание</label>
-                                <textarea name="description" class="form-control" id="description" rows="3"></textarea>
-                            </div>
-                            @include('templates.image_upload')
-                            <div class="form-group text-center">
-                                <input hidden name="user_id" value="{{ \Illuminate\Support\Facades\Auth::id() }}">
-                                <button type="submit" class="btn btn-primary btn-lg" id="submitbtn" name="submit">
-                                    Сохранить
-                                </button>
-                            </div>
-                        </form>
-                    </div>
+<div class="container">
+    <div class="row">
+        <div class="col-md-6 col-md-offset-3" style="max-width:600px;min-width:600px;">
+            <div class="panel panel-primary">
+                <div class="panel-heading">Предложить товар!</div>
+                <div class="panel-body">
+                    {{--<form method="POST" action="{{ route('item.store') }}">--}}
+                    {{--{{ csrf_field() }}--}}
+                    {{--<div class="form-group">--}}
+                    {{--<label for="caption">Заголовок</label>--}}
+                    {{--<input type="text" id="caption" class="form-control" name="caption"--}}
+                    {{--placeholder="Название товара">--}}
+                    {{--</div>--}}
+                    {{--<div class="form-group">--}}
+                    {{--<label for="category">Выберите категорию</label>--}}
+                    {{--<select id="category" class="form-control" name="category_id"--}}
+                    {{--onchange="loadSubcategory(this)">--}}
+                    {{--@foreach($categories as $category)--}}
+                    {{--<option value="{{$category->id}}">{{$category->title}}</option>--}}
+                    {{--<option value="1">{{$category}}</option>--}}
+                    {{--@endforeach--}}
+                    {{--</select>--}}
+                    {{--@if ($errors->has('category'))--}}
+                    {{--<span class="invalid-feedback">--}}
+                    {{--=======--}}
+                    <form enctype="multipart/form-data" method="POST" action="{{ route('item.store') }}">
+                        {{ csrf_field() }}
+                        <div class="form-group">
+                            <label for="caption">Заголовок</label>
+                            <input type="text" id="caption" class="form-control" name="caption"
+                                   placeholder="Название товара">
+                        </div>
+                        <div class="form-group">
+                            <label for="category">Выберите категорию</label>
+                            <select id="category" class="form-control" name="category_id"
+                                    onchange="loadSubcategory(this)">
+                                <option value="" disabled>Выберите категорию</option>
+                                @foreach($categories as $category)
+                                    <option value="{{$category->id}}">{{$category->title}}</option>
+                                @endforeach
+                            </select>
+                            @if ($errors->has('category'))
+                                <span class="invalid-feedback">
+                                    <strong>{{ $errors->first('category') }}</strong>
+                                </span>
+                            @endif
+                        </div>
+                        <div class="form-group">
+                            <label for="subcategory">Выберите подкатегорию</label>
+                            <select id="subcategory" class="form-control" name="subcategory_id">
+                                <option value="" disabled>Выберите подкатегорию</option>
+                                @foreach($subcategories as $subcategory)
+                                    <option value="{{$subcategory->id}}">{{$subcategory->title}}</option>
+                                    {{--<option value="1">{{$subcategory}}</option>--}}
+                                @endforeach
+                            </select>
+                        </div>
+                        <div class="form-group">
+                            <label for="description">Описание</label>
+                            <textarea name="description" class="form-control" id="description" rows="3"></textarea>
+                        </div>
+                        @include('templates.image_upload')
+                        <div class="form-group text-center">
+                            <input hidden name="user_id" value="{{ \Illuminate\Support\Facades\Auth::id() }}">
+                            <button type="submit" class="btn btn-primary btn-lg" id="submitbtn" name="submit">
+                                Сохранить
+                            </button>
+                        </div>
+                    </form>
                 </div>
             </div>
         </div>
     </div>
-    <script>
-        function loadSubcategory(select) {
-            var subcategorySelect = $("#subcategory");
-            $.ajax({
-                url: '{{ route('form.ajax') }}',
-                data: {action: 'getSubcategory', category: select.value},
-                success: function (subcategoryList) {
-                    subcategorySelect.html('');
-                    $.each(subcategoryList, function (i, subcat) {
-                        console.log(subcat);
-                        console.log(subcat.title);
+</div>
 
-                        subcategorySelect.append('<option value="' + subcat.id + '">' + subcat.title + '</option>');
-                    });
+{{--@section('scripts')--}}
+{{--@parent--}}
+<script>
+    function loadSubcategory(select) {
+        var subcategorySelect = $("#subcategory");
+        $.ajax({
+            url: '{{ route('form.ajax') }}',
+            data: {action: 'getSubcategory', category: select.value},
+            success: function (subcategoryList) {
+                subcategorySelect.html('');
+                $.each(subcategoryList, function (i, subcat) {
+                    console.log(subcat);
+                    console.log(subcat.title);
 
-                    subcategorySelect.removeAttr('disabled');
+                    subcategorySelect.append('<option value="' + subcat.id + '">' + subcat.title + '</option>');
+                });
 
-                }
-            });
-
-            console.log('end');
-
-        }
-    </script>
-
-@endsection
-{{--@show--}}
+                subcategorySelect.removeAttr('disabled');
+            }
+        });
+        console.log('end');
+    }
+</script>
+{{--@endsection--}}

+ 2 - 1
resources/views/layouts/app.blade.php

@@ -34,7 +34,8 @@
     @endsection
 </head>
 
-<body class="hero-bkg-animated">
+{{--<body class="hero-bkg-animated">--}}
+<body>
 
 <!-- Navigation panel -->
 @section('navbar')

+ 1 - 2
resources/views/layouts/navbar.blade.php

@@ -74,8 +74,7 @@
             <li class="nav-item">
                 <a class="nav-link" href="{{ route('login') }}">Войти </a>
             </li>
-            @endauth
-            @auth
+            @else
             <li class="nav-item dropdown">
                 <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="{{ route('home') }}" role="button"
                    aria-haspopup="true" aria-expanded="false">{{ auth()->user()->nickname }}</a>

+ 4 - 5
resources/views/templates/item_small_view.blade.php

@@ -16,7 +16,7 @@
                             <i class="fa fa-user" aria-hidden="true"></i>
                         </a>
                         <a class="btn btn-raised btn-primary" href="#sendOffer" title="Предложить на обмен"
-                            data-item-id="{{ $item->id }}">
+                           data-item-id="{{ $item->id }}">
                             <i class="fa fa-envelope" aria-hidden="true"></i>
                         </a>
                         <a class="btn btn-raised btn-danger" href="#" title="Просмотреть">
@@ -27,14 +27,13 @@
                 <div class="card-body">
                     <div class="image float-right user-r">
                         @if(isset($item->picture[0]))
-                            <img src="{{ env('APP_URL'). '/image/' . $item->picture[0]->path }}" class="img-thumbnail" alt="avatar">
+                            <img src="{{ route('image.show', $item->picture[0]->path) }}" class="img-thumbnail" alt="avatar">
                         @else
-{{--                            <img src="{{ base_path('image/items/default') }} class="img-thumbnail" alt="avatar">--}}
-                            <img src="{{ env('APP_URL').'/image/items/default' }}" class="img-thumbnail" alt="avatar">
+                            <img src="{{ route('image.show', '/items/default') }}" class="img-thumbnail" alt="avatar">
                         @endif
                     </div>
                     <div class="description">
-                        <p class="card-text">{{ $item->description }}{{ $item->description }}</p>
+                        <p class="card-text">{{ $item->description }}</p>
                     </div>
                 </div>
             </div>

+ 136 - 0
resources/views/userprofile/index.blade.php

@@ -0,0 +1,136 @@
+@extends('layouts.app')
+
+@section('content')
+    <style>
+        body {
+            /*background-image: url("public/img/fone.jpg");*/
+            background-color: deepskyblue;
+            background: linear-gradient(-85deg, deepskyblue, cadetblue);
+        }
+    </style>
+    <div class="row">
+        <div id="user-panel" class="col-md-3">
+
+            <div class="widget" style="background:#DEB887">
+                <h3>Страница пользователя</h3>
+                <ul>
+                    <li><a href="{{ route('user.profile') }}">Заполнить профиль</a></li>
+                    <li><a href="{{ route('user.item.create') }}">Добавить предмет</a></li>
+                    <li><a href="{{ route('user.items') }}">Мои предметы</a></li>
+                    <li><a href="">Мои обмены</a></li>
+                    <li><a href="">Архив</a></li>
+                </ul>
+            </div>
+
+            <style>
+                * {
+                    box-sizing: border-box;
+                    margin: 0;
+                }
+
+                .widget {
+                    padding: 20px;
+                    border: 5px solid #f1f1f1;
+                    background: #fff;
+                    border-radius: 5px;
+                    font-family: 'Roboto', sans-serif;
+                }
+
+                .widget h3 {
+                    margin-bottom: 20px;
+                    text-align: center;
+                    font-size: 24px;
+                    font-weight: normal;
+                    color: #424949;
+                }
+
+                .widget ul {
+                    margin: 0;
+                    padding: 0;
+                    list-style: none;
+                    width: 250px;
+                }
+
+                .widget li {
+                    border-bottom: 1px solid #eaeaea;
+                    padding-bottom: 20px;
+                    margin-bottom: 20px;
+                }
+
+                .widget li:last-child {
+                    border-bottom: none;
+                    margin-bottom: 0;
+                    padding-bottom: 0;
+                }
+
+                .widget a {
+                    text-decoration: none;
+                    color: #616a6b;
+                    display: inline-block;
+                }
+
+                .widget li:before {
+                    font-family: FontAwesome;
+                    font-size: 20px;
+                    vertical-align: bottom;
+                    color: #dd3333;
+                    margin-right: 14px;
+                }
+
+                .widget li:nth-child(1):before {
+                    content: "\f1ae";
+                }
+
+                .widget li:nth-child(2):before {
+                    content: "\f02d";
+                }
+
+                .widget li:nth-child(3):before {
+                    content: "\f030";
+                }
+
+                .widget li:nth-child(4):before {
+                    content: "\f155";
+                }
+
+                .widget li:nth-child(5):before {
+                    content: "\f19c";
+                }
+            </style>
+        </div>
+
+        <div class="col-md-8">
+            <div class="container">
+                @if(isset($contentContainer))
+                    @php echo $contentContainer @endphp
+                @endif
+                @if (isset($itemsList))
+                    {{--{!! dump($itemsList) !!}--}}
+
+                    {{--                @php echo view('userprofile.templates',['itemsList'=>$itemsList]) @endphp--}}
+                    @foreach($itemsList as $item)
+                        @include('templates.item_small_view',['item'=>$item])
+                    @endforeach
+                @endif
+
+                @if (isset($newItem))
+                    @php echo view('itemregister.item', [
+                                    'categories' => $categories,
+                            'subcategories' => $subcategories,
+                            ]);
+                    @endphp
+                @endif
+
+
+                {{--<img  src="public/img/fone.jpg" alt="Фон" width="100%">--}}
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('scripts')
+    @parent
+    <script>
+
+    </script>
+@endsection

+ 217 - 0
resources/views/userprofile/profile.blade.php

@@ -0,0 +1,217 @@
+<head>
+
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="description" content="">
+    <meta name="author" content="">
+
+    <title>Заполните профиль</title>
+    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"
+          integrity="sha256-3dkvEK0WLHRJ7/Csr0BZjAWxERc5WH7bdeUya2aXxdU= sha512-+L4yy6FRcDGbXJ9mPG8MT/3UCDzwR9gPeyFNMCtInsol++5m3bk2bXWKdZjvybmohrAsn3Ua5x8gfLnbE1YkOg=="
+          crossorigin="anonymous">
+    <!-- Bootstrap Core CSS -->
+    <!--     <link href="css/bootstrap.min.css" rel="stylesheet"> -->
+    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"
+          integrity="sha256-7s5uDGW3AHqw6xtJmNNtr+OBRJUlgkNJEo78P4b0yRw= sha512-nNo+yCHEyn0smMxSswnf/OnX6/KwJuZTlNZBjauKhTK0c+zT+q5JOCx0UFhXQ6rJR9jg6Es8gPuD2uZcYDLqSw=="
+          crossorigin="anonymous">
+
+    <!-- Custom CSS -->
+    <style>
+        body {
+            padding-top: 70px;
+            background: linear-gradient(to bottom, #00FA9A, #1E90FF);
+            /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
+        }
+
+        .othertop {
+            margin-top: 10px;
+        }
+
+
+    </style>
+
+    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
+    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+    <!--[if lt IE 9]>
+    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
+    <![endif]-->
+
+</head>
+
+<body>
+
+<div class="container">
+    {{--@php dump($profile) @endphp--}}
+    @if ($errors->any())
+        <div class="alert alert-danger">
+            <ul>
+                @foreach ($errors->all() as $error)
+                    <li>{{ $error }}</li>
+                @endforeach
+            </ul>
+        </div>
+    @endif
+    <div class="row">
+        <div class="col-md-10 ">
+            <form class="form-horizontal"  method="POST" action="{{ route('user.profile.store') }}">
+                {{ csrf_field() }}
+                <fieldset>
+
+                    <!-- Form Name -->
+                    <legend>Заполнение профиля</legend>
+
+                    <!-- Text input-->
+
+                    <div class="form-group">
+                        <label class="col-md-4 control-label" for="Name ">Имя (Name)</label>
+                        <div class="col-md-4">
+                            <div class="input-group">
+                                <div class="input-group-addon">
+                                    <i class="fa fa-user">
+                                    </i>
+                                </div>
+                                <input id="Имя (Name)" name="name" type="text" placeholder="Имя (Name)"
+                                       class="form-control input-md" value="{{ $profile->name ?? "" }}">
+                            </div>
+
+
+                        </div>
+
+
+                    </div>
+
+                    <!-- Text input-->
+                    <div class="form-group">
+                        <label class="col-md-4 control-label" for="surname">Фамилия (Surname)</label>
+                        <div class="col-md-4">
+
+                            <div class="input-group">
+                                <div class="input-group-addon">
+                                    <i class="fa fa-male" style="font-size: 20px;"></i>
+
+                                </div>
+                                <input id="Фамилия (Surname)" name="surname" type="text" placeholder="Фамилия (Surname)"
+                                       class="form-control input-md" value="{{ $profile->surname ?? "" }}">
+                            </div>
+
+
+                        </div>
+                    </div>
+
+
+                    <!-- Multiple Radios (inline) -->
+                    <div class="form-group">
+                        <label class="col-md-4 control-label" for="Gender">Пол (Gender)</label>
+                        <div class="col-md-4">
+                            <label class="radio-inline" for="Gender-0">
+                                <input type="radio" name="gender" id="Gender-0" value="1" {{ ($profile->gender === "1") ? "checked='checked'" : "" }}>
+                                Male
+                            </label>
+                            <label class="radio-inline" for="Gender-1">
+                                <input type="radio" name="gender" id="Gender-1" value="2" {{ ($profile->gender === "2") ? "checked='checked'" : "" }}>
+                                Female
+                            </label>
+                        </div>
+                    </div>
+
+                    <!-- Text input-->
+                    <div class="form-group">
+                        <label class="col-md-4 control-label" for="Country">Страна (Country)</label>
+                        <div class="col-md-4">
+                            <div class="input-group">
+                                <div class="input-group-addon" >
+                                    <i class="fa fa-home"></i>
+
+                                </div>
+                                <input id="Country" name="country" type="text" placeholder="Страна (Country)"
+                                       class="form-control input-md" value="{{ $profile->country ?? "" }}">
+                            </div>
+
+                        </div>
+                    </div>
+
+                    <!-- Text input-->
+                    <div class="form-group">
+                        <label class="col-md-4 control-label" for="City">Город (City)</label>
+                        <div class="col-md-4">
+                            <div class="input-group">
+                                <div class="input-group-addon">
+                                    <i class="fa fa-home"></i>
+
+                                </div>
+                                <input id="City" name="city" type="text" placeholder="Город (City)"
+                                       class="form-control input-md" value="{{ $profile->city ?? "" }}">
+                            </div>
+
+
+                        </div>
+                    </div>
+
+                    <!-- Text input-->
+                    <div class="form-group">
+                        <label class="col-md-4 control-label" for="Age">Возраст (Age)</label>
+                        <div class="col-md-4">
+                            <div class="input-group">
+                                <div class="input-group-addon">
+                                    <i class="fa fa-calendar"></i>
+
+                                </div>
+                                <input id="Age" name="age" type="text" placeholder="Возраст (Age)"
+                                       class="form-control input-md" value="{{ $profile->age ?? "" }}">
+                            </div>
+
+
+                        </div>
+                    </div>
+
+                    <!-- Text input-->
+                    <div class="form-group">
+                        <label class="col-md-4 control-label" for="Hobby">Хобби (Hobby)</label>
+                        <div class="col-md-4">
+                            <div class="input-group">
+                                <div class="input-group-addon">
+                                    <i class="fa fa-camera-retro"></i>
+
+                                </div>
+                                <input id="Hobby" name="hobby" type="text" placeholder="Хобби (Hobby)"
+                                       class="form-control input-md" value="{{ $profile->hobby ?? "" }}">
+
+                            </div>
+
+                        </div>
+                    </div>
+
+                    <div class="form-group text-center">
+                        <input hidden name="user_id" value="{{ Auth::id() }}">
+                        <button type="submit" class="btn btn-primary btn-lg">
+                            Сохранить
+                        </button>
+                    </div>
+
+                    <div class="text-center">
+                        <button type="submit" class="btn btn-primary btn-lg">
+                            Назад
+                        </button>
+                    </div>
+
+                </fieldset>
+            </form>
+        </div>
+        <div class="col-md-2 hidden-xs">
+            <img src="http://websamplenow.com/30/userprofile/images/avatar.jpg" class="img-responsive img-thumbnail ">
+        </div>
+
+
+    </div>
+</div>
+<!-- jQuery Version 1.11.1 -->
+<script src="js/jquery.js"></script>
+
+<!-- Bootstrap Core JavaScript -->
+<script src="js/bootstrap.min.js"></script>
+
+</body>
+
+</html>

+ 82 - 0
resources/views/userprofile/profile_form.blade.php

@@ -0,0 +1,82 @@
+<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
+<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
+
+<!------ Include the above in your HEAD tag ---------->
+
+<form class="form-horizontal" method="post" action="{{ route('user.profile.store') }}">
+    <fieldset>
+
+        <!-- Form Name -->
+        <legend>Информация о пользователе</legend>
+
+        <!-- Text input-->
+        <div class="form-group">
+            <label class="col-md-4 control-label" for="textinput">Имя</label>
+            <div class="col-md-4">
+                <input disabled id="Имя (Name)" name="name" type="text" placeholder="Имя (Name)"
+                       class="form-control input-md" value="{{ $profile->name ?? "" }}">
+
+            </div>
+        </div>
+
+        <!-- Text input-->
+        <div class="form-group">
+            <label class="col-md-4 control-label" for="textinput">Фамилия</label>
+            <div class="col-md-4">
+                <input disabled id="Фамилия (Surname)" name="surname" type="text" placeholder="Фамилия (Surname)"
+                       class="form-control input-md" value="{{ $profile->surname ?? "" }}">
+
+            </div>
+        </div>
+
+        <div class="form-group">
+            <label class="col-md-4 control-label" for="textinput">Пол</label>
+            <div class="col-md-4">
+                <input disabled id="Пол (Gender)" name="gender" type="text" placeholder="Пол (Gender)"
+                       class="form-control input-md" value="{{ $profile->gender=='m' ? 'Мужской':'Женский'}}">
+            </div>
+        </div>
+
+
+        <!-- Text input-->
+        <div class="form-group">
+            <label class="col-md-4 control-label" for="textinput">Страна</label>
+            <div class="col-md-4">
+                <input disabled id="Country" name="country" type="text" placeholder="Страна (Country)"
+                       class="form-control input-md" value="{{ $profile->country ?? "" }}">
+
+            </div>
+        </div>
+
+        <!-- Text input-->
+        <div class="form-group">
+            <label class="col-md-4 control-label" for="textinput">Город</label>
+            <div class="col-md-4">
+                <input disabled id="City" name="city" type="text" placeholder="Город (City)"
+                       class="form-control input-md" value="{{ $profile->city ?? "" }}">
+
+            </div>
+        </div>
+
+        <!-- Text input-->
+        <div class="form-group">
+            <label class="col-md-4 control-label" for="textinput">Возраст</label>
+            <div class="col-md-4">
+                <input disabled id="Age" name="age" type="text" placeholder="Возраст (Age)"
+                       class="form-control input-md" value="{{ $profile->age ?? "" }}">
+
+            </div>
+        </div>
+
+        <!-- Text input-->
+        <div class="form-group">
+            <label class="col-md-4 control-label" for="textinput">Хобби</label>
+            <div class="col-md-4">
+                <input disabled id="Hobby" name="hobby" type="text" placeholder="Хобби (Hobby)"
+                       class="form-control input-md" value="{{ $profile->hobby ?? "" }}">
+
+            </div>
+        </div>
+
+    </fieldset>
+</form>

+ 121 - 0
resources/views/userprofile/templates.blade.php

@@ -0,0 +1,121 @@
+{{--@extends('layouts.app')--}}
+
+{{--@section('content')--}}
+
+{{--<link href="{{ asset('css/item_info_page.css') }}" rel="stylesheet">--}}
+{{--<link href="{{ asset('css/bootstrap.4.min.css') }}" rel="stylesheet">--}}
+{{--<script src="{{ asset('js/bootstrap.4.min.js') }}"></script>--}}
+
+<style>
+
+    .wraper-top {
+        min-height: 50px;
+    }
+
+    .item-small-view {
+        margin-top: 20px;
+        max-width: 600px;
+        min-width: 600px;
+        height: 175px;
+    }
+
+    .item-small-view .description {
+        overflow: hidden;
+        max-height: 110px;
+        text-align: left;
+    }
+    #item-small-view img {
+        width: 100%;
+        height: 100%;
+    }
+
+    #item-small-view div {
+        min-height: 100px;
+        max-height: 100px;
+        overflow: hidden;
+
+    }
+
+    #item-small-preview {
+        padding: 5px;
+        background-color: #cccccc;
+        max-width: 100px;
+        min-width: 100px;
+    }
+
+    #item-small-information {
+        padding: 5px;
+        background-color: lightgoldenrodyellow;
+    }
+
+    .card-body .card-text {
+        font-size: 15px;
+    }
+
+    #item-small-manipulate {
+        padding: 5px;
+        background-color: #cccccc;
+        max-width: 50px;
+        min-width: 50px;
+    }
+
+
+    .user-r {
+        padding-left: 6px;
+    }
+    .user-l >img,
+    .user-r >img {
+        width: 150px;
+    }
+    .redes >ul li a {
+        width: 42px;
+        margin-left: 5px;
+        margin-right: 5px;
+        text-align: center;
+        border-radius: 10em;
+        border: #EEE 1px solid;
+    }
+    .redes >ul li span {
+        color: #CCC;
+        font-size: 18px;
+    }
+    .footer {
+        padding: 16px 0;
+    }
+
+
+
+</style>
+
+<div class="wraper-top">
+</div>
+
+@foreach($itemsList as $item)
+    <div class="col-md-12 item-small-view">
+        <div class="card">
+            <h4 class="card-header text-right bg-dark text-white">{{ $item->caption }}
+                <div class="float-left small">
+                    <a class="btn btn-raised btn-danger" href="#" title="Ver perfil de Miguel92" data-toggle="tooltip" data-placement="top">
+                        <i class="fa fa-user" aria-hidden="true"></i>
+                    </a>
+                    <a class="btn btn-raised btn-danger" href="#" title="Enviar mensaje">
+                        <i class="fa fa-envelope" aria-hidden="true"></i>
+                    </a>
+                    <a class="btn btn-raised btn-danger" href="#" title="Seguir usuario">
+                        <i class="fa fa-eye" aria-hidden="true"></i>
+                    </a>
+                </div>
+            </h4>
+            <div class="card-body">
+                <div class="image float-right user-r">
+                    <img src="image/{{ $item->picture[0]->path }}" class="img-thumbnail" alt="avatar">
+                </div>
+                {{--<h4 class="card-title">{{ $item->caption }}</h4>--}}
+                <div class="description">
+                    <p class="card-text">{{ $item->description }}</p>
+                </div>
+            </div>
+        </div>
+    </div>
+@endforeach
+{{--@endsection--}}

+ 13 - 5
routes/web.php

@@ -68,11 +68,19 @@ Route::group(['prefix' => 'user', 'middleware' => ['auth']], function () {
 
 //--------- USERS ROUTES ---------------------------------------------------------------------------
 
-Route::get('/users/item/index', 'UsersItemController@index');
+Route::group(['prefix' => 'user', 'middleware' => ['auth']], function () {
+    Route::get('/item/index', 'UsersItemController@index');
+    Route::get('/item', 'UsersItemController@create')->name('user.item.create');
+    Route::post('/item/', 'UsersItemController@store')->name('item.store');
+    Route::any('/form/ajax', "RegisterItemController@jsonSubcategoryRequest")->name('form.ajax');
+
+    Route::get('/home', "ProfileController@index")->name('home');
+    Route::any('/items', "ProfileController@showAllItems")->name('user.items');
 
-Route::get('/users/item', 'UsersItemController@create')->name('user.item.create');
-Route::post('/users/item/', 'UsersItemController@store')->name('item.store');
-Route::any('/users/form/ajax', "RegisterItemController@jsonSubcategoryRequest")->name('form.ajax');
+    Route::get('/profile', "RegisterProfileController@create")->name('user.profile');
+    Route::post('/profile', "RegisterProfileController@store")->name('user.profile.store');
+
+});
 
 //------- OUT OF AUTH ROUTEs -----------------------------------------------------------------------
 Route::get('/dashboard', 'DashboardController@index')->name('dashboard');
@@ -100,4 +108,4 @@ Route::get('/item/{item}', 'ItemsInfoController@show');     /// это долж
 Auth::routes();
 
 //Route::get('/', 'HomeController@welcome')->name('welcome');
-Route::get('/home', 'HomeController@index')->name('home');
+Route::get('/home', 'HomeController@index');