35 lines
813 B
PHP
35 lines
813 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Session , DB;
|
|
|
|
class Menu extends Model
|
|
{
|
|
static public function save_new($data){
|
|
|
|
$menu = new self();
|
|
$menu ->link = $data['link'];
|
|
$menu ->mtitle = $data['title'];
|
|
$menu ->url = $data['url'];
|
|
$menu ->save();
|
|
Session::flash('sm' , 'Menu Has been saved');
|
|
}
|
|
|
|
static public function find_item($id){
|
|
$sql = 'SELECT * FROM menus m WHERE m.id = ?';
|
|
$item = DB::select($sql,[$id] );
|
|
return $item;
|
|
}
|
|
|
|
static public function update_item($data,$id){
|
|
$menu = self::find($id);
|
|
$menu ->link = $data['link'];
|
|
$menu ->mtitle = $data['title'];
|
|
$menu ->url = $data['url'];
|
|
$menu ->save();
|
|
Session::flash('sm' , 'Menu Has been Updated!');
|
|
}
|
|
|
|
}
|