db::query("update member set ncaptcha = 0 where id = :memberId", $memberId);
, эх..public function destroy(int $memberId){
//Что тут и зачем хз, что там происходит ты не написал
parent::destroy();
try{
//Что такое db? PDO?
//Далее почти тупо копипаст из маст рид книги для новичоков Php right way
$stmt = db::prepare('update member set ncaptcha = 0 where id = :memberId');
$stmt->bindParam(':memberId', $memberId, PDO::PARAM_INT);
if(!$stmt->execute()){
throw new Exception($stmt->errorInfo()[2]);
}
}
catch (Exceprion $e ) {
throw $e;
}
//А и мы что-нибудь возвращаем? Если да, то выше нужно указать и тип возвращаемого значения у метода
}
//Где-то в далеких недрах кодинга
try {
$tvoyPeremenayaClass->destroy($memberId);
}
catch (Exception $e)
{
echo 'Прости Юра, мы все просрали ...' . $e->getMessage();
}
{{ dump(user) }}
, это обертка php var_dump. Чтобы она заработала нужно включить режим дебага для Twig.$twig = new Twig_Environment($loader, array(
'debug' => true,
// ...
));
$twig->addExtension(new Twig_Extension_Debug());
return redirect()->route('contact')->withInput($request->all);
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class ContactController extends Controller
{
public function showContactForm()
{
return view('default.contact')->withTitle('Contacts');
}
public function storeContactForm(Request $request, $id=FALSE)
{
return redirect()->route('front.showContactForm')->withInput($request->all);
}
}
Route::get('/contcats', 'ContactController@showContactForm')->name('front.showContactForm');
Route::post('/contcats', 'ContactController@storeContactForm');
<input type="text" name="username" value="{{ old('username') }}">
session()
. /routes/web.php
://Главная
Route::get('/', 'FrontController@index')->name('front.index');
//Здесь выводим список постов
Route::get('/posts', 'FrontController@showPosts')->name('front.posts');
//Здесь показываем конкретный пост, если у тебя имяя не уникальное, то тогда лучше используй id
Route::get('/posts/{post_name}', 'FrontController@showPost')->name('front.show_post');
/app/Http/Controllers/FrontController.php
public function showPost($post_name)
{
$post = Post::where('name', $post_name)->first();
return view('front.post',compact(['post']));
}
//Здесь показываем конкретный пост, если у тебя имяя не уникальное, то тогда лучше используй id
Route::get('/post-{post_id}', 'FrontController@showPost')->name('front.show_post')->where(['post_id'=>'[0-9]+']);;