plugin wip

This commit is contained in:
Joey Kimsey
2024-12-17 22:45:47 -05:00
parent 0955fb4175
commit e537771708
42 changed files with 1043 additions and 693 deletions

View File

@ -57,15 +57,15 @@ class Products extends AdminController {
public function edit( $id = null ) {
if ( !Input::exists( 'submit' ) ) {
return Views::view( 'members.admin.products.edit', self::$posts->findById( $id ) );
return Views::view( 'members.admin.products.edit', self::$products->findById( $id ) );
}
if ( !Forms::check( 'editMembershipProduct' ) ) {
Issues::add( 'error', [ 'There was an error with your form.' => Check::userErrors() ] );
return $this->index();
}
if ( self::$posts->updatePost( $id, Input::post( 'title' ), Input::post( 'blogPost' ), Input::post( 'submit' ) ) === true ) {
Issues::add( 'success', 'Post Updated.' );
if ( self::$products->updatePost( $id, Input::post( 'name' ), Input::post( 'description' ), Input::post( 'monthly_price' ), Input::post( 'yearly_price' ) ) === true ) {
Issues::add( 'success', 'Your product Updated.' );
return $this->index();
}
Issues::add( 'error', 'There was an error with your request.' );
@ -75,9 +75,9 @@ class Products extends AdminController {
public function view( $id = null ) {
$data = self::$products->findById( $id );
if ( $data !== false ) {
return Views::view( 'blog.admin.view', $data );
return Views::view( 'members.admin.products.view', $data );
}
Issues::add( 'error', 'Post not found.' );
Issues::add( 'error', 'Product not found.' );
$this->index();
}

View File

@ -39,7 +39,13 @@ class Records extends AdminController {
public function edit( $data = null ) {
}
public function view( $data = null ) {
public function view( $id = null ) {
$data = self::$memberships->findById( $id );
if ( $data !== false ) {
return Views::view( 'members.admin.memberships.view', $data );
}
Issues::add( 'error', 'Membership not found.' );
$this->index();
}
public function delete( $data = null ) {