/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, ['brand_name' => 'required|unique:brand'], ['brand_name.required' => 'Please enter brand name.'], ['brand_name.unique' => 'brand already exists']); $brand = new Brand(); $brand->brand_name = $request->brand_name; $brand->slug = $request->slug; $brand->save(); $brand->category()->sync($request->cate); return redirect()->route('admin.brand.index')->with('alert-success', 'ADD complete'); }
// echo "<h2> // mno = $mc->mno <br> // fullname = $mc->fullname <br> // gender = $mc->gender <br> // plus_blogger = $mc->plus_blogger <br> // lastname = $mc->lastname <br> // firstname = $mc->firstname <br> // identity_username = $mc->identity_username <br> // blog_name = $mc->blog_name <br> // $mc->blogdom <br> // </h2>"; use app\Brand; $db = new Database(); $db->connect(); $brand = new Brand($db, $mc->mno); $brandContent = $brand->brand(0, $brand->category('', '', '', 'brand'), 2, 'welcome', '', 'bno desc', 12); $brandContent1 = $brand->brand(0, $brand->category('', '', '', 'topic'), 2, 'welcome', '', 'bno desc', 12); $brandContent_len = count($brandContent) < 12 ? count($brandContent) : 12; $brandContent1_len = count($brandContent1) < 12 ? count($brandContent1) : 12; //$brand2 = $brand->category(0, 0, 0, 'brand', 'bcno desc', '1,2'); //print_r($brandContent); ?> <!DOCTYPE html> <html lang="en"> <head> <?php $path = ''; ?>
$page = $_GET['page']; $type = strtolower($_GET['type']); $gender = $_GET['gender'] != 'all gender' ? $_GET['gender'] : ''; echo "</div>"; //echo "type = $type <br>"; $count = 0; if ($page > 1) { $count = $page - 1; } $end = 15; $start = $count * $end; // get topic or brand. if ($type == 'topic') { //echo "inside topic <br>"; if ($brand == 'all topics') { $brandContent = $brandObject->brand(0, $brandObject->category('', '', '', 'topic'), 2, 'welcome', '', 'bno desc', "{$start}, {$end}"); } else { $brandContent = $brandObject->brand(0, $brandObject->category('', $brand, '', 'topic')[0]['bcno'], 2, 'welcome', '', 'bno desc', "{$start}, {$end}"); } } else { //echo "inside brand <br>"; if ($brand == 'all style') { echo "all style <br>"; $brandContent = $brandObject->brand(0, $brandObject->category('', '', $gender, 'brand'), 2, 'welcome', '', 'bno desc', "{$start}, {$end}"); } else { echo " bcno = " . $brandObject->category('', $brand, $gender, 'brand')[0]['bcno']; echo "specific style <br>"; $brandContent = $brandObject->brand(0, $brandObject->category('', $brand, $gender, 'brand'), 2, 'welcome', '', 'bno desc', "{$start}, {$end}"); } } // Print modal and more button
public function topic() { $brand = new Brand($this->db, $this->mno); return $brand->WhereIn($brand->category('', '', '', 'topic')); }