I'm quite new in Laravel, so please be forgiving for me and give me some suggestions as i am not at all need proper solution. Just wants to learn something new, but it's hard to find it.
It'll be progressive topic, so let's start :
My idea is to create dynamic menu based on Arrays in Model on the left side of the page. It has to be build by user's choice. For example :
- If user choose 'Products' from "nav bar" at the top then the menu should shown at the left panel which is called "nav menu" with proper Products' category and also the content in the proper content div in the middle of the page. I hope it clears what i mean.
Basically, i need to create a Model, let's call it "Menu" so :
php artisan make:model Menu
Then Controller for that Model "MenuController" :
php artisan make:controller MenuController --model=Menu
Ok, now i created Arrays in Model like this :
namespace App;
use Illuminate\Database\Eloquent\Model;
class Menu extends Model
{
protected $Data1 = [
'Category' => 'someCategory',
'SubCategory' => [
1 => 'subcategory 1',
2 => 'subcategory 2',
3 => 'subcategory 3',
4 => 'subcategory 4'
],
];
protected $Data2 = [
'Category' => 'someCategory',
'SubCategory' => [
1 => 'subcategory 1',
2 => 'subcategory 2',
3 => 'subcategory 3',
4 => 'subcategory 4'
],
];
}
For now my question is, is that good way "i'm walking through" ? as i have doubts. What should i do next ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire