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