Skip to content

Instantly share code, notes, and snippets.

@Tjoosten
Created December 5, 2017 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tjoosten/6f12f29b9a9e92fac35f1e48da5ef14d to your computer and use it in GitHub Desktop.
Save Tjoosten/6f12f29b9a9e92fac35f1e48da5ef14d to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers;
use App\Repositories\NewsRepository;
use Illuminate\Http\Request;
use Illuminate\View\View;
/**
* Class NewsController
*
* @package App\Http\Controllers
*/
class NewsController extends Controller
{
private $newsRepository; /** @var NewsRepository $newsRepository */
/**
* NewsController constructor.
*
* @param NewsRepository $newsRepository
*
* @return void
*/
public function __construct(NewsRepository $newsRepository)
{
$this->middleware('auth');
$this->middleware('lang');
$this->newsRepository = $newsRepository;
}
/**
* Get the admin control panel for the news messages.
*
* @return \Illuminate\View\View
*/
public function backendIndex(): View
{
return view('news.backend-index', [
'messages' => $this->newsRepository->entity()->simplePaginate(15)
]);
}
public function create(): View
{
return view('news.backend-create');
}
public function store(Request $input)
{
dd($input->all());
}
}
array:1 [▼
"_token" => "IXQeQuWKz7icr8NuewrNT626z5gyB9v5D02ESlcP"
]
<div class="form-group row">
<label class="col-lg-2 col-form-label text-lg-right">Titel: <span class="text-danger">*</span></label>
<div class="col-lg-10">
<input type="text" class="form-control{{ $errors->has('1.dutch.title') ? ' is-invalid' : '' }}" name="[0][dutch][title]" value="{{ old('1.dutch.title') }}">
@if ($errors->has('1.title'))
<div class="invalid-feedback">
<strong>{{ $errors->first('1.dutch.title') }}</strong>
</div>
@endif
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label text-lg-right">Categoieen: <span class="text-danger">*</span></label>
<div class="col-lg-10">
<input type="text" placeholder="Bericht categorieen" class="form-control{{ $errors->has('2.dutch.categories') ? ' is-invalid' : '' }}" name="[2][dutch][categories]" value="{{ old('2.dutch.categories') }}">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label text-lg-right">Bericht: <span class="text-danger">*</span></label>
<div class="col-lg-10">
<textarea name="[3][dutch][message]" rows="7" placeholder="Uw nieuwsbericht" class="form-control{{ $errors->has('3.dutch.message') ? 'is-invalid' : ''}}">{{ old('.dutch.message') }}</textarea>
@if ($errors->has('3.dutch.message'))
<div class="invalid-feedback">
<strong>{{ $errors->first('3.dutch.message') }}</strong>
</div>
@endif
</div>
</div>
@push('scripts')
<script src="https://cdn.ckeditor.com/4.7.3/standard/ckeditor.js"></script>
<script>
CKEDITOR.replace('[3][dutch][message]');
// CKEDITOR.replace('[3][french][message]');
// CKEDITOR.replace('[3][english][message]');
</script>
@endpush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment