/** * Run the database seeds. * * @return void */ public function run() { DB::statement('SET FOREIGN_KEY_CHECKS = 0'); // disable foreign key constraints User::truncate(); Profile::truncate(); Language::truncate(); Expertise::truncate(); Meetup::truncate(); Photo::truncate(); Model::unguard(); $this->call('UsersTableSeeder'); $this->call('ProfilesTableSeeder'); $this->call('LanguagesTableSeeder'); $this->call('ExpertisesTableSeeder'); $this->call('MeetupsTableSeeder'); $this->call('PhotosTableSeeder'); Model::reguard(); DB::statement('SET FOREIGN_KEY_CHECKS = 1'); // enable foreign key constraints }
public function deletePrivateImage(Request $request) { $request->session()->reflash(); $photo_id = $request->all()['photo_id']; if (!$photo_id) { return Response::json(['message' => 'Photo id has not been assigned.'], 403); } $photo = Photo::findOrFail($photo_id); $photo->image->destroy(); $photo->delete(); return Response::json(['message' => 'The file on the server has been removed.'], 200); }