/** * Handles basic storing of our Model * * @param array $input * */ public function store(array $input) { // Instantiate a new Model $model = new $this->model(); // Fill the new Model with our input $model->fill($input); // Is this Model using slugs? if (isset($input['slug'])) { // If the slug is empty use the title, other wise use the provided slug $model->slug = $input['slug'] == '' ? Str::Slug($input['title']) : Str::slug($input['slug']); } // If the meta title is empty use the title, otherwise use the provided meta title $model->meta_title = $input['meta_title'] == '' ? $input['title'] : $input['meta_title']; // If the meta description is empty use the content, otherwise use the provided meta description $model->meta_description = $input['meta_description'] == '' ? $input['content'] : $input['meta_description']; // Attempt to save the model $model->save(); // Return the model return $model; }