var https = require('https');
var fs = require('fs');
var port = 3001;
var options = {
key: fs.readFileSync('www_site_com.key').toString(),
cert: fs.readFileSync('www_site_com.crt').toString(),
ca: fs.readFileSync('www_site_com.ca-bundle').toString()
};
var app = https.createServer(options);
var io = require('socket.io').listen(app); //socket.io server listens to https connections
app.listen(port, "0.0.0.0", function() {
console.log('Listening on Port:' + port);
});
var https = require('https');
var fs = require('fs');
var port = 3001;
var options = {
key: fs.readFileSync('www_site_com.key').toString(),
cert: fs.readFileSync('www_site_com.crt').toString(),
ca: fs.readFileSync('www_site_com.ca-bundle').toString()
};
var app = https.createServer(options);
var io = require('socket.io').listen(app); //socket.io server listens to https connections
app.listen(port, "0.0.0.0", function() {
console.log('Listening on Port:' + port);
});
return '<span>' + repo.text + '</span>';
return '<option>' + repo.text + '</option>'
function formatRepo (repo) {
if(repo.category || repo.parent){
return '<optgroup class="select2-optgroup" label="' + repo.category + ' > ' + repo.parent + '"><option class="select2-opt" name="spares[' + repo.id + ']" id="spares[' + repo.id + ']" value="' + repo.id + '">' + repo.text + '</option></optgroup>';
}
return '<option class="select2-opt" name="spares[' + repo.id + ']" id="spares[' + repo.id + ']" value="' + repo.id + '">' + repo.text + '</option>';
}
function formatRepo (repo) {
if(repo.category || repo.parent){
return '<div class="select2-optgroup">'+repo.category+ '>'+ repo.parent +'</div><div class="select2-opt" name="spares[' + repo.id + ']" id="spares[' + repo.id + ']" value="' + repo.id + '">' + repo.text + '</div>';
}
return '<div class="select2-opt" name="spares[' + repo.id + ']" id="spares[' + repo.id + ']" value="' + repo.id + '">' + repo.text + '</div>';
}
public function store_user(UserRequest $request)
{
$user = new User();
$user-> login = $request['login];
//....
$user->save();
$address = new AddressBook();
$address-> full_name = $request['full_name];
//....
$address->save();
//ну или
$user = User::create($request->all());
$address_book = AddressBook::create($request->all());
//по идее тоже должно сработать
}
('first', 'comedy', 5),
('second', 'comedy', 7),
Ну так генерируйте slug для brand_name и model_name и храните их так же в БД.
public function handle($request, Closure $next)
{
$language = Request::cookie('lang', Config::get('app.locale'));
App::setLocale($language);
return $next($request);
}
Route::group([ 'middleware' => ['maintenance_mode', 'locale']], function()
{
//Change language
Route::get('set_lang/{id}', ['as' => 'set_lang', 'uses' => 'HomeController@set_lang']);
}
public function set_lang($id){
$response = new \Illuminate\Http\Response('Set Lang');
return $response->withCookie(cookie()->forever('lang', $id));
}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
{{ trans('main.'.config('app.locales')[Config::get('app.locale')]) }} <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-langs">
@foreach(config('app.locales') as $k=>$val)
@if(config('app.locale') != $k)
<li><a href="{{ route('set_lang', ['id' = $k]) }}"> {{ trans('main.'.$val) }}</a></li>
@endif
@endforeach
</ul>
<!-- /.dropdown-user -->
</li>
public function render($request, Exception $e)
{
if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) {
return abort(404);
}
return parent::render($request, $e);
}
@foreach(Categories::all() as $category)
{{ $category->name }} <span class="badge">{{ Post_categories::where('categories_id', $category->id)->count() }}</span>
@endif
class Categories extends Model {
public function posts()
{
//Получаем множество постов, опубликованных в категории
return $this->hasMany('App\PostCategories', 'categories_id', 'id');
}
}
public function index(){
//Получаем коллекцию категорий, где есть посты. Есть постов в категории нет, то ее не будет в выборке.
$categories = Categories::has('posts')->get();
return view('index', compact('categories'));
}
@foreach($categories as $category)
{{ $category->name }} <span class="badge">{{ $category->posts->count() }}</span>
@endif
<?php
if(date('h') >= 18 and date('h') <= 7){
echo "звоните на мобильный";
} else {
echo "звоните на рабочий";
}
?>