Skip to content

Commit

Permalink
Jquery project
Browse files Browse the repository at this point in the history
  • Loading branch information
Hegabovic committed Apr 3, 2022
0 parents commit b137aba
Show file tree
Hide file tree
Showing 24 changed files with 2,411 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions .idea/Jquery-Restaurant-Menu.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Model/DatabaseConnector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
//require_once("../vendor/autoload.php");
namespace Model;
use Illuminate\Database\Capsule\Manager as DBC;

class DatabaseConnector
{
private $dbc;

public function __construct()
{
$this->dbc = new DBC();
$this->dbc->addConnection(CONNECTION_STRING);
$this->dbc->setAsGlobal();
$this->dbc->bootEloquent();
}

/**
* @return DBC
*/
public function getDbc()
{
return $this->dbc;
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{https://cdnjs.com/libraries/jquery}[javascript]
Binary file added Resources/Images/CaramelPecanbonBites.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Images/CaramelPecanbonRoll.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Images/Chocobon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Images/ClassicRoll.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Images/bg.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Images/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/Images/bg1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions Services/MealServices.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

namespace Services;

use Model;
use Illuminate\Database\Capsule\Manager;
use Illuminate\Support\Collection;
use Model\DatabaseConnector;

class MealServices
{
private DatabaseConnector $DBC;
private Manager $connection;



public function __construct()
{
$this->DBC = new DatabaseConnector();
$this->connection = $this->DBC->getDbc();
}


/**
* Get All Items in Table
* @return Collection
*/
function getMeals(): Collection
{
return $this->connection->table("Meals")->get();
}

/**
* Get specific item from table using id
* @param int $id
* @return stdClass|null
*/
function getProductById(int $id): ?stdClass
{
if ($id > 0) {
return $this->connection->table("products")->where("id", "=", "$id")
->select(["name","description","price","image"])->first();
} else {
return null;
}
}

/**
* Get specific item from table using id
* @param String $name
* @param String $description
* @param int $price
* @param string $img
*/
function updateTableMeals(int $id,string $name,string $description,int $price ,string $img): int
{
return $this->connection->table("meal")
->where('id', $id)
->update([ "name" => $name ,"description" =>$description, "price" => $price, "image" =>$img]);
}


// insert products : for future plans
/**
* Add new product to database
* @param String $name
* @param String $description
* @param int $price
* @param string $img
* @return bool
*/
function addProduct(string $name, string $description, int $price, string $img): bool
{
return $this->connection->table("meal")->insert(['name' => $name, 'description' => $description, 'price'=>$price, 'image'=>$img]);
}

/**
* Delete product from database
* @param int $id
* @return int
*/
function deleteProduct(int $id): int
{
return $this->connection->table("meal")
->where('id', '=', $id)->first()->delete();
}

}
Loading

0 comments on commit b137aba

Please sign in to comment.