public function testSaveDelete() { RoyaltyShare::truncate(); $rp = new RoyaltyShare(); $rp->royalty_share_name = "testname"; $rp->save(); $this->assertTrue($rp->id != 0); $this->assertTrue($rp->created != null); $this->assertTrue($rp->updated != null); // $this->assertTrue($rp["deleted"] == 0); $rp->delete(); $this->assertTrue($rp->deleted == 1); RoyaltyShare::truncate(); }
public static function boot() { parent::boot(); RoyaltyShare::deleting(function ($royaltyShare) { $royaltyShare->deleted = 1; $royaltyShare->update(); }); }
public function run() { DB::table('royalty_types')->truncate(); RoyaltyShare::create(['royalty_share_name' => 'Publisher\'s Share', 'royalty_share_name_short' => 'Publisher', 'royalty_share_name_symbol' => 'PUB']); RoyaltyShare::create(['royalty_share_name' => 'Writer\'s Share', 'royalty_share_name_short' => 'Writer', 'royalty_share_name_symbol' => 'WRI']); RoyaltyShare::create(['royalty_share_name' => 'Artist\'s Share', 'royalty_share_name_short' => 'Artist', 'royalty_share_name_symbol' => 'ART']); RoyaltyShare::create(['royalty_share_name' => 'Producer\'s Share', 'royalty_share_name_short' => 'Producer', 'royalty_share_name_symbol' => 'PROD']); }
public static function apiProviders($id) { $query = self::query(); return $query->select('royalty_provider.id as id', 'royalty_provider.royalty_provider_name as provider', 'royalty_share.royalty_share_name as share', 'royalty_type.royalty_type_name as type')->join(RoyaltyStreamFile::table() . " as royalty_stream_file", 'royalty_stream_file.deal_id', '=', 'deal_id')->join(RoyaltyProvider::table() . " as royalty_provider", 'royalty_provider.id', '=', 'royalty_provider_id')->join(RoyaltyShare::table() . " as royalty_share", 'royalty_share.id', '=', 'royalty_share_id')->join(RoyaltyType::table() . " as royalty_type", 'royalty_type.id', '=', 'royalty_type_id')->groupBy('royalty_provider.royalty_provider_name', 'royalty_share.royalty_share_name', 'royalty_type.royalty_type_name')->where('deal_id', $id)->get(); }