(Fix) Closes #187

- Foreign Key Migration Updated
- Model Updated
- Controller Updated
This commit is contained in:
HDVinnie
2018-02-22 12:05:10 -05:00
parent e55ef392ee
commit 526e61fe1d
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -23,8 +23,8 @@ class Category extends Model
*
*/
public $rules = [
'name' => 'required|unique:categories',
'slug' => 'required|unique:categories',
'name' => 'required',
'slug' => 'required',
'icon' => 'required',
'meta' => 'required'
];
@@ -91,6 +91,6 @@ class CategoryController extends Controller
{
$category = Category::findOrFail($id);
$category->delete();
return redirect()->route('staff_category_index')->with(Toastr::error('Category Sucessfully Deleted', 'Whoops!', ['options']));
return redirect()->route('staff_category_index')->with(Toastr::success('Category Sucessfully Deleted', 'Yay!', ['options']));
}
}
@@ -24,7 +24,7 @@ class AddForeignKeysToTorrentsTable extends Migration
public function up()
{
Schema::table('torrents', function (Blueprint $table) {
$table->foreign('category_id', 'category_id')->references('id')->on('categories')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('category_id', 'category_id')->references('id')->on('categories')->onUpdate('RESTRICT')->onDelete('CASCADE');
});
}