/**
  * Muestra un formulario para actualizar una categoría.
  *
  * @param  \Soundcore\Category $category
  * @return Response
  */
 public function edit(Category $category)
 {
     $categories_count = Category::count();
     return view('admin.categories.edit', compact('category', 'categories_count'));
 }
Example #2
0
<?php

use Soundcore\Models\Category;
use Soundcore\Models\Landing;
use Soundcore\Models\User;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(User::class, function ($faker) {
    return ['name' => $faker->name, 'email' => $faker->email, 'password' => str_random(10), 'remember_token' => str_random(10)];
});
$factory->define(Landing::class, function ($faker) {
    $title = $faker->sentence(6);
    $permalink = str_replace(' ', '-', str_replace('.', '', strtolower($title)));
    $category_count = Category::count();
    return ['category_id' => $faker->numberBetween(1, $category_count), 'title' => $title, 'permalink' => $permalink, 'description' => $faker->paragraph(2), 'content' => $faker->text(300), 'active' => $faker->numberBetween(0, 1), 'image_alt' => $title, 'meta_title' => $title, 'meta_description' => $faker->paragraph(2), 'meta_robots' => $faker->randomElement(['index, follow', 'noindex, nofollow'])];
});