How to I get $model
warmwhisky opened this issue · 1 comments
warmwhisky commented
Please be sure you include all the relevant information in your issue so we can help you:
-
[I've not got it going yet ] steps taken to reproduce your issue
-
[ It's a fresh install] your configuration file(s), where relevant
-
[
protected $connection = 'mysql3';
/**- The primary key associated with the table.
- @var string
*/
protected $primaryKey = 'prod_id';
use Searchable;
use Taggable;
] a copy of your Models that use or extend this package (just the relevant parts!) -
any other code we might need to help
Hi,
I am not sure how I initialise the $model variable in your usage docs? What am I missing?
Thanks
cviebrock commented
Hi,
You can create or retrieve any model using the regular Laravel methods:
$model = new MyModel($attributes);
// or
$model = MyModel::find(1);
// or
$model = MyModel::where(...)->first();
// etc.
Once you have an instance of your model class, then you can tag it as per the docs for this package.
$model->tag('cool', 'new');$model->tag(['Apple', 'Banana', 'Cherry']);
$model->save();