Added handler
This commit is contained in:
parent
bb834494bd
commit
992874ce1c
@ -7,7 +7,6 @@ use App\Models\Access;
|
|||||||
use \Core\Token;
|
use \Core\Token;
|
||||||
use \Core\Session;
|
use \Core\Session;
|
||||||
use \Core\Redirect;
|
use \Core\Redirect;
|
||||||
use \Core\Validate;
|
|
||||||
|
|
||||||
class Posts
|
class Posts
|
||||||
{
|
{
|
||||||
@ -70,8 +69,6 @@ class Posts
|
|||||||
'posts' => $posts,
|
'posts' => $posts,
|
||||||
'status' => $status
|
'status' => $status
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function entry()
|
public function entry()
|
||||||
@ -86,8 +83,6 @@ class Posts
|
|||||||
'user' => $user,
|
'user' => $user,
|
||||||
'token' => Token::generate()
|
'token' => Token::generate()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
Redirect::to('/');
|
Redirect::to('/');
|
||||||
}
|
}
|
||||||
@ -159,7 +154,8 @@ class Posts
|
|||||||
foreach ($args as $value) {
|
foreach ($args as $value) {
|
||||||
if ($value == '') {
|
if ($value == '') {
|
||||||
Session::flash('info', 'All data must not be empty');
|
Session::flash('info', 'All data must not be empty');
|
||||||
Redirect::to('./entry');
|
Redirect::to('/');
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,6 +182,9 @@ class Posts
|
|||||||
if ($this->post->update($table, $args, $id)) {
|
if ($this->post->update($table, $args, $id)) {
|
||||||
Session::flash('info', 'Data successfuly updated');
|
Session::flash('info', 'Data successfuly updated');
|
||||||
Redirect::to('/');
|
Redirect::to('/');
|
||||||
|
} else {
|
||||||
|
Session::flash('info', 'Data must not be same');
|
||||||
|
Redirect::to("./$id");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user