Skip to content

Instantly share code, notes, and snippets.

View Denkong's full-sized avatar

Simada Denkong

  • Cheboksary, Russia
View GitHub Profile
@Denkong
Denkong / LARAVEL - экспорт XML
Last active August 28, 2018 08:38
LARAVEL - экспорт XML
$exportDate=DB::table('Klienty')->get();
// dd($exportDate);
$export='<?xml version="1.0"?>'."\n";
$export.='<Klienty>'."\n";
foreach ($exportDate as $key => $value) {
$export.='<'.$value->id.'>'."\n";
$export.='<Uslugi>'."\n";
$export.=$value->Uslugi."\n";
$export.='</Uslugi>'."\n";
@Denkong
Denkong / PHP - справочник
Last active August 28, 2018 08:39
PHP - справочник
<?
//ПЕРЕМЕННЫЕ
$a=100; //integer
$b=14.21; //float
$c='Hello!';//string
$c1='World';//string
$d1=[12,23]; //array массивы
$j= false; //boolean bool
$f=array(
'name'=>'Denis', //echo $f['name'];
@Denkong
Denkong / JQUERY - справочник
Last active August 28, 2018 08:40
JQUERY - справочник
$(document).ready(function(){
$('#id') //по id
$('TagName') //по имени тега
$('.class') //по имени тега
$('.class').css('boreder','solid 3px red'); //обращение к css
$('.class').parent().css('boreder','solid 3px red'); //обращение к родителям элементам
@Denkong
Denkong / AJAX
Last active August 28, 2018 08:41
AJAX
PHP:
<?
try {
$dbh = new PDO('mysql:dbname=name;host=host', 'login', 'password');
} catch (PDOException $e) {
die($e->getMessage());
}
$MTS = $dbh->prepare('SELECT * FROM test ORDER BY score DESC LIMIT 10' );
$MTS->execute();
@Denkong
Denkong / LARAVEL - cookie
Last active August 28, 2018 08:43
LARAVEL - cookie
@Denkong
Denkong / LARAVEL - авторизация через name
Last active December 7, 2018 12:40
LARAVEL - авторизация через name
В app/http/controllers/auth/registercontrolle.php
добавляем
'name' => 'required|string|max:255|unique:users',
в resurces/views/auth/login.blade.php вмесо полей email пишем name
В app/http/controllers/auth/LoginController
public function username()
{
@Denkong
Denkong / LARAVEL - конструкторы и шаблонизаторы
Last active August 28, 2018 08:45
LARAVEL - конструкторы и шаблонизаторы
app/http/controlleers
php artisan make:controller Name - создание
class IndexController extends Controller
{
public function show()
{
@Denkong
Denkong / LARAVEL -маршрутизация
Last active August 28, 2018 08:46
LARAVEL -маршрутизация
routes/web.php
Route::get('/', function () {
return view('welcome');
}); - сразу вызывает resources/views
Route::get('/', 'IndexController@show'); -на контроллер
Route::get - для получения данных
Route::post для отправки данных
@Denkong
Denkong / LARAVEL - посредники
Last active August 28, 2018 08:47
LARAVEL - посредники
app/Http/Middleware/
php artisan make:middleware OldMiddleware - создание
Пример
if ($request->input('age') < 200)
{
return redirect('/');
}
@Denkong
Denkong / LARAVEL - работа с БД и пагинация и модели
Last active November 19, 2018 10:31
LARAVEL - работа с БД и пагинация и модели
-----------------------------Для исправления ошибки---------------------------------------
app/Providers/AppServiceProvider.php
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}