-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1201977
commit bfd7409
Showing
15 changed files
with
136 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\View\Components; | ||
|
||
use Illuminate\View\Component; | ||
|
||
class HelloWorld extends Component | ||
{ | ||
/** | ||
* Create a new component instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Get the view / contents that represent the component. | ||
* | ||
* @return \Illuminate\Contracts\View\View|\Closure|string | ||
*/ | ||
public function render() | ||
{ | ||
return view('components.hello-world'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
<!-- TODO Blade Задание 4: Сделать проверку авторизован пользователь или нет --> | ||
<!-- Если да то вывести ID пользователя --> | ||
<!-- ID пользователя вывести внутри конструкции с проверкой --> | ||
<!-- ID пользователя вывести внутри конструкции с проверкой --> | ||
@auth | ||
{{ auth()->user()->id }} | ||
@endauth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
{{ \Carbon\Carbon::now()->format('Y-m-d') }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
<!-- TODO Blade Задание 2: Изменить реализацию этой view, расширить ее с использованием layout --> | ||
<!-- layouts/app.blade.php --> | ||
|
||
@extends('layouts.app') | ||
|
||
<!-- TODO Blade Задание 6: В эту view с контроллера передается collection c users в переменной data --> | ||
<!-- Выполнить foreach loop в одну строку --> | ||
<!-- Используйте view shared/user.blade.php для item (переменная user во item view) --> | ||
<!-- Используйте view shared/empty.blade.php для состояния когда нет элементов в колекции --> | ||
|
||
|
||
@forelse($data as $item) | ||
@include('shared/user', ['user' => $item]) | ||
@empty | ||
@include('shared/empty') | ||
@endforelse | ||
|
||
|
||
|
||
|
||
<!-- TODO Blade Задание 7: Здесь сделайте классический foreach loop --> | ||
<!-- Выведите div с $user->name --> | ||
<!-- Воспользуйтесь переменной $loop и у нечетных div выведите класс - bg-red-500 --> | ||
|
||
@foreach($data as $user) | ||
<div class="{{ $loop->even ? 'bg-red-500' : '' }}">{{ $user->name }}</div> | ||
@endforeach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,77 @@ | ||
<?php | ||
|
||
use App\Http\Controllers\IndexController; | ||
use App\Http\Controllers\UserController; | ||
use App\Http\Controllers\UserCrudController; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
//TODO Route Задание 1: По GET урлу /hello отобразить view - /resources/views/hello.blade (без контроллера) | ||
// Одна строка кода | ||
|
||
Route::get("/hello", function () { | ||
return view("hello"); | ||
}); | ||
|
||
//TODO Route Задание 2: По GET урлу / обратиться к IndexController, метод index | ||
// Одна строка кода | ||
|
||
Route::get('/', [IndexController::class, 'index']); | ||
|
||
//TODO Route Задание 3: По GET урлу /page/contact отобразить view - /resources/views/pages/contact.blade | ||
// с наименованием роута - contact | ||
// Одна строка кода | ||
|
||
Route::get('/page/contact', function (){ | ||
return view('pages.contact'); | ||
})->name('contact'); | ||
|
||
//TODO Route Задание 4: По GET урлу /users/[id] обратиться к UserController, метод show | ||
// без Route Model Binding. Только параметр id | ||
// Одна строка кода | ||
|
||
Route::get('/users/{id}', [UserController::class, 'show']); | ||
|
||
//TODO Route Задание 5: По GET урлу /users/bind/[user] обратиться к UserController, метод showBind | ||
// но в данном случае используем Route Model Binding. Параметр user | ||
// Одна строка кода | ||
|
||
Route::get('/users/bind/{user}', [UserController::class, 'showBind']); | ||
|
||
|
||
//TODO Route Задание 6: Выполнить редирект с урла /bad на урл /good | ||
// Одна строка кода | ||
|
||
Route::redirect('/bad', '/good'); | ||
|
||
//TODO Route Задание 7: Добавить роут на ресурс контроллер - UserCrudController с урлом - /users_crud | ||
// Одна строка кода | ||
|
||
Route::resource('users_crud', UserCrudController::class); | ||
|
||
|
||
//TODO Route Задание 8: Организовать группу роутов (Route::group()) объединенных префиксом - dashboard | ||
|
||
Route::group(['prefix' => 'dashboard'], function () { | ||
|
||
// Задачи внутри группы роутов dashboard | ||
//TODO Route Задание 9: Добавить роут GET /admin -> Admin/IndexController -> index | ||
|
||
Route::get('/admin', [\App\Http\Controllers\Admin\IndexController::class, 'index']); | ||
|
||
//TODO Route Задание 10: Добавить роут POST /admin/post -> Admin/IndexController -> post | ||
|
||
Route::post('/admin/post', [\App\Http\Controllers\Admin\IndexController::class, 'post']); | ||
}); | ||
|
||
//TODO Route Задание 11: Организовать группу роутов (Route::group()) объединенных префиксом - security и мидлваром auth | ||
|
||
Route::group(['prefix' => 'security', 'middleware' => 'auth'], function () { | ||
|
||
// Задачи внутри группы роутов security | ||
//TODO Задание 12: Добавить роут GET /admin/auth -> Admin/IndexController -> auth | ||
|
||
Route::get('/admin/auth', [\App\Http\Controllers\Admin\IndexController::class, 'auth']); | ||
}); | ||
|
||
|
||
require __DIR__ . '/default.php'; | ||
require __DIR__ . '/default.php'; |