public function postCreate()
 {
     $categories = array_values(Input::get('categories'));
     $brand = Brand::create(['name' => Input::get('brand')]);
     $brand->categories()->attach($categories);
     return Redirect::back();
 }
Exemplo n.º 2
0
 function create()
 {
     if ($this->_user['id'] == 2 || $this->_user['id'] == 1) {
         $this->set('alert', '1');
     } else {
         $this->set('alert', '0');
     }
     if (isset($_POST['submit'])) {
         $brand = $_POST['brand'];
         $br = new Brand();
         $br->description = $brand['text'];
         $br->image = $brand['image'];
         $br->url = $brand['url'];
         $br->deck_id = $brand['deck'];
         $br->create();
         $deck = new Deck();
         $deck->id = $brand['deck'];
         $deck->title = $deck->getTitle();
         $deck->slug_title = $deck->sluggify($deck->title);
         header('Location: deck/' . $brand['deck'] . '_' . $deck->slug_title);
     } else {
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $category = $this->categories->create($request->only('name', 'description', 'parent_id', 'sort_order'));
     return \Redirect::route('admin.categories.index')->with('message', 'Your category has been created!');
 }